After reading the
java tutorial :
"Synchronized methods enable a simple strategy for preventing
thread interference and memory consistency errors: if an object is visible to more than one thread, all reads or writes to that object's variables are done through synchronized methods."
Since all objects have the potential to be visible to more than one thread hould I synchronize all mutative methods in all classes I write as a standard procedure. I'm thinking of changing all my setters to the form:
public synchronized void setSomething(int val);
I'm not sure if this is a good idea or is excessively cautious (can there be such a thing) and if this a possible source of performance problems for larger projects.