How do you kill a java.lang.Thread in Java?
java.lang.Thread
See this thread by Sun on why they deprecated Thread.stop(). It goes into detail about why this was a bad method and what should be done to safely stop threads in general.
Thread.stop()
The way they recommend is to use a shared variable as a flag which asks the background thread to stop. This variable can then be set by a different object requesting the thread terminate.
1.4m articles
1.4m replys
5 comments
57.0k users