This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Confirming notify()
 
Similar Threads
Threads question from khalid mock exam
where i use notifyall and where should i use notify
notify confusion..?
Logical/File Locking and nested synchronisation
Misunderstanding with the wait() method.