aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Confirming notify() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Confirming notify()" Watch "Confirming notify()" New topic
Author

Confirming notify()

Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
It is not must that the Thread which called the notify() will leave the running state.Since if there will be no Thread in waiting pool,then to whome it will notify?, and therefore will continue to run.
Is this concept is correct?
Bye.
Viki.
------------------
Count the flowers of ur garden,NOT the leafs which falls away!


Count the flowers of your garden, NOT the leafs which falls away!
Prepare IBM Exam 340 by joining http://groups.yahoo.com/group/IBM340Exam/
Rashmi Tambe
Ranch Hand

Joined: Aug 07, 2001
Posts: 418
Originally posted by Vikrama Sanjeeva:
It is not [b]must that the Thread which called the notify() will leave the running state.Since if there will be no Thread in waiting pool,then to whome it will notify?, and therefore will continue to run.
Is this concept is correct?
Bye.
Viki.
[/B]

That's right vikram...the thread calling notify does not necessarily leave the running state irrespective of how many or which threads are notified. It totally depends on the scheduler. Therefore can't be predicted! Even if there r threads in waiting pool there's no guarantee that one of the notoified threads would run immediately.
HTH
Rashmi
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
It is not the call to notify, the one that makes the threads waiting to compite to adquire the lock, but the call to wait. Also if the run methods of the running thread ends.


SCJP2. Please Indent your code using UBB Code
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Confirming notify()