Note that if the run() method used notify() instead of notifyAll(), there would be a chance that only one reader would be notified instead of all the readers.
The notify method should be called for an object only when the current thread has already locked the object�s lock. If the wait set for the object is not empty, then some arbitrarily chosen thread is removed from the wait set and reenabled for thread scheduling. (Of course, that thread will not be able to proceed until the current thread relinquishes the object�s lock.)
The notifyAll method should be called for an object only when the current thread has already locked the object�s lock. [B} Every thread [B] in the wait set for the object is removed from the wait set and re-enabled for thread scheduling. (Of course, those threads will not be able to proceed until the current thread relinquishes the object�s lock.)
Rich
SCJP 1.4
<a href="http://psiriwardena.blogspot.com/" target="_blank" rel="nofollow">http://psiriwardena.blogspot.com/</a><br />B.Sc(Eng),SCJP,SCWCD,SCBCD,SCDJWS,<br />MCSD,OCA,CCNA.BCS,ACS