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.
I am confused between sleep and suspend. It is written in the site "http://java.sun.com/products/jdk/1.2/docs/guide/misc/threadPrimitiveDeprecation.html" that suspend causes deadlock. But sleep is the same thing. So, it should also cause deadlock. 1) The following para is written in the site: "Thread.suspend is inherently deadlock-prone. If the target thread holds a lock on the monitor protecting a critical system resource when it is suspended, no thread can access this resource until the target thread is resumed. If the thread that would resume the target thread attempts to lock this monitor prior to calling resume, deadlock results". Does it mean that if the thread that is holding the lock is suspended, before some other thread locks the object it has to call resume(). 2) Stopping a thread causes it to unlock all the monitors that it has locked. They have said to use "volatile" variable to indicate that the thread can be stopped. private volatile Thread blinker;