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.
When one of the thread is already inside the synchronized block ' label 3' (has acquired the lock of this object), then all other threads will be able to run till 'label 1' and get blocked for the object lock once they reach 'label 2' (Running State -> Blocked State) and hecne they won't be able to run 'label 4'.
Synchronization does not prevent multiple threads from running a method at the
same time. Rather, it grants an object lock to just one thread giving it exclusive
access to the object - not the code. Other threads are free to run the same code.
Consider many instances of a class and many identical threads. Separate threads
can be simultaneously working through the same synchronized method, each holding
a lock on a different object. The JVM is constantly swapping out the running thread.