Thread.stop method, although it does stop a running thread, however, this method is unsafe and is not advocated, and the Stop method should not be used to close the Java thread.
The correct method should be to set the volatile Boolean stop = False, so that all threads can detect a change in the stop value in a timely manner, the thread runs during a periodic or critical point check of the stop value, and when the stop is found to be true by another thread, the thread's run is terminated.
But the above method also has the imperfect place, when the thread waits, sleep and so on the case will not be able to judge the value of stop, that is to say the thread may always block down. So you want to close the thread, in addition to checking the stop value for periodic or critical points, and calling interrupt to break the blocking state of the thread.
Even if you do the above, the thread may not terminate immediately, waiting for the end of the operating system to be dispatched.
Executorservice's shutdown is to slow down the thread pool, unable to join the new task, Shutdownnow want to close the thread pool immediately, Shutdownnow call interrupt, but call interrupt, is not immediately closed.
Executorservice does not call shutdown, the thread pool is closed 1 minutes after all tasks have been completed.
Some problems with shutting down threads