He is called, changes it and sees a conclusion
...
} catch (InterruptedException e) {
System.out.println(i + " interrupted");
Thread.currentThread().interrupt();
}
...
the problem is that ThreadPoolExecutor uses its own Thread to start your task and will interrupt this thread, not yours. It makes no sense to extend Thread, instead to implement Runnable. If you are still using Thread, you can call MyThread.interrupt () directly from MyThread.run ()
source
share