I am trying to close all my thread in my threadpool.
Usually I try:
while(!Thread.currentThread().isInterrupted()) {...
To close the while loop…
But I have one Thread which only consists about
while(!Thread.currentThread().isInterrupted()) {//which is true
This is how I close the threads:
pool.shutdownNow();
So how would you close such a Thread?
You can add a
volatilebooleanflag.Now you can just call
Update:
From Java doc of shutdownNow()
So either you will have to define your interruption policy by preserving the interrupts