The relationship between the thread lock of Java and the entry set and wait set, or the figure contains the mysteries of the Java thread. If you do not understand this figure or have never seen it, it only indicates that the Java thread lock is completely unknown.
(1) All threads that are expected to get the Lock will enter the entry set area of the Object Lock when the Lock has been owned by other threads.
(2) When all the locks have been obtained but other necessary conditions are not met and wait is required, the thread enters the wait set area of the Object Lock.
(3) When the Thread in the wait set area receives the Notify/notifyAll notification, a random Thread (Notify) or all threads (NotifyALL) the wait set area of the Object Lock enters the entry set.
(4) When the thread with the Lock is released, the thread in the entryset area of the Object Lock will seize the Lock, however, only one Thread can obtain the lock, while other threads still wait in the entry set for the next time to seize the lock and then execute the lock.
Refer:
1. http://lass.cs.umass.edu /~ Shenoy/courses/fall01/labs/talab2.html
2. http://stackoverflow.com/questions/289434/how-to-make-a-java-thread-wait-for-another-threads-output
3. http://java.sun.com/docs/books/jls/second_edition/html/memory.doc.html
4. https://prof.hti.bfh.ch/myf1/opsys1/CourseNotes/javasem.pdf