Pete Kleczka wrote:
If I have a class that is accessed by multiple threads (e.g. Spring bean with singleton scope used in a web application) can I chain methods safely without synchronizing. That is, if I have method: public String getStuff(), and that method calls on several private helper methods on the same class, do I have to synchronize on the private helpers?
If all the calls to those private methods comes from code that's already synced, then no, you don't have to. Once you obtain the lock, you keep it until you leave the sync block or call wait().
If, however, you also call those private methods from an unsynced method or block, then, yes, you have to sync those private methods.