spring threadpooltaskexecutor causes memory leak in tomcat
<p>I know this question was asked couple of times but none have provided a correct answer so reposting</p>

<p>I have a Spring4-Jersey webservice that runs inside Tomcat 7.</p>

<p>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.</p>

<p>However, I have noticed when I shutdown Tomcat, it warns me that it can't shutdown some tasks.</p>

<pre><code>    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
</code></pre>

<p>this what I have in code to initialize taskExecutor</p>

<pre><code>@Bean(destroyMethod="shutdown")
 public Executor taskExecutor() {
     return Executors.newScheduledThreadPool(100);
 }
</code></pre>

<p><a href="http://docs.spring.io/spring/docs/3.2.0.RC1_to_3.2.0.RC2/changes/docdiffs_org.springframework.scheduling.annotation.html" rel="nofollow">http://docs.spring.io/spring/docs/3.2.0.RC1_to_3.2.0.RC2/changes/docdiffs_org.springframework.scheduling.annotation.html</a></p>

<p>mentions that spring would take care of the threads that i created; but unfortunately it doesn't seem to be case...</p>

<p>Could someone provide any pointers ??</p>