When is it OK to use Thead.stop() in Java?
问题 The Java Docs for Thread.stop() make it sound like the world will end if you ever call Thread.stop(). Deprecated . This method is inherently unsafe. Stopping a thread with Thread.stop causes it to unlock all of the monitors that it has locked (as a natural consequence of the unchecked ThreadDeath exception propagating up the stack). If any of the objects previously protected by these monitors were in an inconsistent state, the damaged objects become visible to other threads, potentially