This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
A thread does not lose ownership of any monitors when it encounters sleep. So, unlock action doesn't happen because of sleep method.
Joined: Nov 22, 2008
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?