Reputation: 431
Hey I'm using with TaskScheduler object to schedule a few task in a different time.
I can't find the way to stop all the tasks, the only way I found is to restart my server(application) and I don't want to do it.
I have been trying to set the executer to null but it didn't work.
I'm attaching my code:
private TaskScheduler executor;
public void createSched() {
Runnable task;
task=()-> LOGGER.info("hello");
TimeZone time=TimeZone.getTimeZone("UTC");
executor.schedule(task, new CronTrigger("0,5,10,15,20,25,30 * * * * ?",time));
// this.executor=null;
}
after the code above the tasks keep going and I cant stop it anymore...
Upvotes: 2
Views: 523