Candibiotic
News Update :

Communicating with Objects by Waiting and Notifying

Friday, August 21, 2009

The wait() method lets a thread to be added to a waiting pool, unless it is invoked again to run
The notify() method is used to send a signal to one and only one of the threads that are waiting in that same object's waiting pool.
The notify() method can NOT specify which waiting thread to notify.
The method notifyAll() works in the same way as notify(), only it sends the signal to all of the threads waiting on the object.
All three methods—wait(), notify(), and notifyAll()—must be called from within a synchronized context! A thread invokes wait() or notify() on a particular object, and the thread must currently hold the lock on that object.
Share this Article on :

0 comments:

Post a Comment

 

© Copyright Vinayak Wins 2010 -2011 | Design by Herdiansyah Hamzah | Published by Borneo Templates | Powered by Blogger.com.