Matt Brown wrote:When a thread is in sleep 1000ms (Thread.sleep(1000)), does the thread unlock the resource during the 1000ms so other threads can access the resource?
I don't think thread.sleep releases the lock, it's wait()
thanks & regards
Edward Harned wrote:Sudhakar Sharma is correct. sleep() does not release locks.
The Thread.sleep() method doesn't release any JDBC connections either.
What about join() and yield()?
Matt Brown wrote:So wait() and waitFor() will cause the thread to release the resource, including the JDBC Connection?
No, waitFor() doesn't release anything. And wait() only releases the lock on the object used to call wait(), not any other resource.
Matt Brown wrote:What about join() and yield()?
These don't release anything.