I am add new threads like this using ThreadPoolTaskExecutor :
threadPoolTaskExecutor.execute(new Runnable() {
@Override
public void run() {
while(true){
doSomething();
}
Thread.sleep(1000);
}
});
All active threads are not stopped, when I shutdown this executor:
threadPoolTaskExecutor.shutdown();
Is there option how to stop this active threads using ThreadPoolTaskExecutor?
You should set setWaitForTasksToCompleteOnShutdown(false) when create ThreadPoolTaskExecutor.
Default is false, shutting down immediately through interrupting ongoing tasks and clearing the queue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With