How to stop Interruptible Threads in Java
Posted
by
Dr.Lesh
on Stack Overflow
See other posts from Stack Overflow
or by Dr.Lesh
Published on 2010-12-29T17:48:11Z
Indexed on
2010/12/29
17:54 UTC
Read the original article
Hit count: 187
I have a Java application that I CAN'T EDIT that starts a Thread wich has this run method:
public void run(){
while(true){
System.out.println("Something");
}
}
And at a certain moment I wanna stop it, but if I use thread.interrupt();
it won't work.
If I use thread.stop();
it works, but this method is deprecated and its use is discouraged because soon it will be removed from JVM.
Does anyone knows how to do it?
Thank you.
© Stack Overflow or respective owner