This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Synchronization 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 "Synchronization" Watch "Synchronization" New topic
Author

Synchronization

Sundeep Gupta
Greenhorn

Joined: Feb 28, 2006
Posts: 13
Hi all,


Does a thread releases lock on all the objects when it calls wait() on an object, or only the lock of that specific object is released.

I think other object's lock will be held with thread.

Tell me whether i'm right or wrong


Thanks,
Sundeep


SCJP 5.0
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18507
    
  40

wait() will only release the lock on the object that you are waiting on.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Synchronization
 
Similar Threads
// object lock doubt
Help!
how to acquire a lock on object.
Thread locks
notifyall