As per spring documentation for setWaitForTasksToCompleteOnShutdown
Set whether to wait for scheduled tasks to complete on shutdown
Does it mean that if any task is stuck on some long running process and we explicity try to stop the container, it will not be terminated untill that task is finished?
@Bean
public TaskExecutor myAsyncTaskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(20);
executor.setMaxPoolSize(30);
executor.setQueueCapacity(50);
executor.setWaitForTasksToCompleteOnShutdown(true); // How it behaves?
//executor.afterPropertiesSet();
executor.setThreadNamePrefix("MY-ASYNC-TASK");
executor.initialize();
return executor;
}
Thanks for the answers.