To avoid data corruption in multithreaded Java programs, shared data must be protected from concurrent modifications and accesses, as detailed in CON00-J. Synchronize access to shared mutable variables. This can be done at the object level by using synchronized
blocks (coarse-grained locking), as a result locking out other threads from interfering. If synchronization is used judiciously, deadlocks do not usually crop up (See CON00CON07-J. Do not invoke a superclass method or constructor from a synchronized region in the subclass).
...