title: Java: Is there a way where I can remove all ThreadLocals before undeploying my application?
body: <p>I'm getting this error:</p>
  
  <pre><code>SEVERE: The web application [/app] appears to have started a thread named [ImmediateThread-1469817702874] but has failed to stop it. This is very likely to create a memory leak.
  </code></pre>
  
  <p>I am using Jersey for this and I believe it creates the <code>ImmediateThread</code> and basically, I have no control over this. Is there any way where I can just access all <code>ThreadLocal</code> objects and remove them on <code>contextDestroyed()</code>?</p>
  
  <p>I understand that this can be ignored if we just basically restart the Tomcat server but I would love to have the privilege to just undeploy and deploy apps without worrying about possible memory leaks.</p>
  
  <p>I'm using Java 7, Tomcat 7, Jersey, Hibernate.</p>