This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I implemented lock and unlock methods with synchronized blocks. And locking called within update and delete methods of the Data class on the server side. On the client side I didn't implement locking. My question is now.. Must I also set the modifier of all methods of the Data class as synchronized? Some of people did. But why should I do that?
Hi Baris, I think this is a very fundemental and important question in SCJD. Make sure you know what you mean when you add synchronized on a method. It is actually locking the corresponding object for that thread. Therefore, the question should not be "synchronize all method", it instead should be "overall locking mechanism". In Max Habibi's book he suggest to synchorize all public methods. If you use the same wrapper class design, maybe it is a good idea. Still, the question goes to your locking mechanism.
I play Java for fun.<br /> <br />SCJP / SCJD / SCWCD / SCBCD