Number Of Page View:100,000+/Months
LOGIN |New User


What is the difference between notifyand notifyAll method ?
THe notify() method wakes up a single thread waiting on the object and passes the control of the monitor to it. The notifyAll() method will wake up all the threads waiting on the object and will select a thread to pass control to it. The unselected thread will again go back to sleep
in the JVM scheduler list and they will need yet another call to notifty (or notifyAll) in order to wake them up. The notifyAll() method is the same as the notify() method. The only difference is that in this case all the threads from the non-empty wait set of the object are removed and are re-enabled for thread scheduling in stead of only one thread from the wait set being picked arbitrarily, removed, and re-enabled for thread scheduling as is the case in notify() method.