好吧,我的视频转换器中有一个线程负责对视频进行转码。它是一个user thread
与setDaemon(false)
.
为了停止它,我调用了该threadName.interrupt()
方法,但是它并没有停止。它继续!
我该如何阻止它?
这是我尝试阻止它的方法:
if(getExecutingTaskID() == taskID){
int what = JOptionPane.showOptionDialog(frame,
"Do you want to interrupt an executing task?",
"Task already running",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null, null, null);
if(what == JOptionPane.YES_OPTION){
if(getExecutingTaskID() == taskID){
converter.interrupt();
}
return true;
}
}
return false;
}