我有一个带有方法的类(运行线程):
public void execute() {
List<Task> task = read();
for (Task task: tasks) {
Thread thread = new Thread(task);
thread.start();
try {
thread.join();
} catch (InterruptedException e) {
break;
}
}
}
我有一些像这样的方法的任务类:
public void run() {
Thread.currentThread.interrupt();
}
如何从任务类设置中断到主类?