wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Notify all Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Notify all" Watch "Notify all" New topic
Author

Notify all

Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 215

Hi all,
I have a question regarding notifyall(),wait() and notify().
What if i notify a thread which is not waiting on an objects lock,i.e what if the code with notify() runs before the code with wait()?
Piyush Joshi
Ranch Hand

Joined: Jun 10, 2011
Posts: 207

Sudhanshu Mishra wrote: what if the code with notify() runs before the code with wait()?

then nothing will happen.
For example:


thread2 will keep on waiting on lock1.

Piyush
 
 
subject: Notify all
 
Similar Threads
notify,thread,applet
A question about notify()
notify() and notifyAll()
K&B
question on wait()