To understand synchronization, focus more on the objects involved and their
lock status rather than the method. The goal is to protect object state as the
JVM shares the CPU among threads; preventing multiple threads from operating
simultaneously on the same object. This does not mean that only one copy of
the method is running. Rather, it means that each copy of the method must
lock and operate on a different object.
Methods are not blocked, nor is access to any object. Non-synchronized code can
trash an object's state even while a synchronized method is holding its lock. This is
why it's so important that all changes to critical objects be done in synchronized code,
so locks are obtained before any changes are made. Missing one can cause trouble.
Jim ...
...