File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Does wait () ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Does wait () ?" Watch "Does wait () ?" New topic
Author

Does wait () ?

Sid Robin
Ranch Hand

Joined: Nov 24, 2007
Posts: 53
does wait() relinquish currently executing object's lock ? in a synchronized method ? I am hoping the answer to be yes with a little Explanation about the protocols between notify and wait ?
Venkat Kanneganti
Ranch Hand

Joined: Nov 30, 2007
Posts: 43
whenever wait() method is encountered by thread which releases monitor(lock) of Object ,go to wait utill some other thread enters same objects monitor and calls notify()
Peter Ricke
Greenhorn

Joined: Dec 07, 2007
Posts: 24
does wait() relinquish currently executing object's lock ?

the thread calling wait() does not need the lock of the currently executing object but needs the lock of the object whichs wait()-method it is calling.



Here sync2() can be excecuted only by calling sync(), where the thread gets o1's Lock. direct calling of sync() results in java.lang.IllegalMonitorStateException


========<br />class a{<br /> a a(a a){return (a)a;}<br />}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Does wait () ?
 
Similar Threads
where is the notify?
About Object lock
Thread -Help maha anna
Clarification in wait, notify and notifyAll methods
IllegalMonitorStateException