aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes lock in threads 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 "lock in threads" Watch "lock in threads" New topic
Author

lock in threads

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hello,
Can anybody tell me which are the methods other then wait(), which compels the thread to release the lock.
thanks
Shikhar
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
stop
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi sanjay,
thanks for reply.
What about yield() and sleep()
satish
Greenhorn

Joined: Jul 03, 2000
Posts: 27
A thread does not lose ownership of any monitors when it encounters sleep. So, unlock action doesn't happen because of sleep method.


satish
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I believe the method interrupt(), and since we are talking about depreciated methods (like stop()) then suspend() as well, will get the thread to release its lock. That leads me to wonder on a tangent. Since, and when, wait() can be timed, is it guaranteed to resume control of the lock irregardless of the priority of any threads that were using the synched code while wait() was counting? I realize that it would be an exception to the general fact that there seems to be little guarantee of any execution of prioritized interrelation between threads, but I have adopted a paranoiac disbelief in making general conclusions of Java's behavioristics. Any corrections or comments here?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: lock in threads
 
Similar Threads
Database Lock(-1)?
sleep() and locks
Lets play a word game...
WA #1.....word association
regarding static method