I know this question was asked couple of times but none have provided a correct answer so reposting
I have a Spring4-Jersey webservice that runs inside Tomcat 7.
I am using Spring's ThreadPoolTaskExecutor to process some messages off a queue. I have a bean that uses @Scheduled which submits tasks to the executor every 1000 millis.
However, I have noticed when I shutdown Tomcat, it warns me that it can't shutdown some tasks.
SEVERE: The web application appears to have started a thread named [taskExecutor-9] but has failed to stop it. This is very likely to create a memory leak.
org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
this what I have in code to initialize taskExecutor
@Bean(destroyMethod="shutdown")
public Executor taskExecutor() {
return Executors.newScheduledThreadPool(100);
}
mentions that spring would take care of the threads that i created; but unfortunately it doesn't seem to be case...
Could someone provide any pointers ??