Re: How does JDK 5.0 works
You need to check the JDK 5.0 synchronized feature that a code block is declared synchronized, there are two important consequences, usually refers to the code has the atomic (atomicity) and visibility (visibility). Atomic means that a thread can only monitor the implementation by a designated object (lock) to protect the code, in order to prevent multiple threads updating the shared state conflict. Visibility is more subtle; it to deal with memory cache, and compiler optimization of a variety of abnormal behaviors. Best of luck.