Forum

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

Reply

Using notifyAll() When Many Threads May Be Waiting
In this topic we know that notify all of the threads which thread are  wainting on a perticular object.if its correct then we can use notifyAll() on the object to let all the threads rush out of the waiting area and back to runnable.
notifyAll(); // Will notify all waiting threads

--------------------------------------------------
Class Object  | Class Thread  |Interface Runnable|
--------------------------------------------------
wait()        |    start()    |     run()        |
--------------------------------------------------
notify()      |    yield()    |                  |
--------------------------------------------------
notifyAll()   |    sleep()    |                  |
--------------------------------------------------
              |    join()     |                  |
-------------------------------------------------