com.atlassian.threadlocal
Class BruteForceThreadLocalCleanup

java.lang.Object
  extended by com.atlassian.threadlocal.BruteForceThreadLocalCleanup

public class BruteForceThreadLocalCleanup
extends java.lang.Object

Code copied from Tomcat 7 to clean up thread locals. If we do this ourselves we avoid unnecessary warnings and angst from customers and support. This works on Tomcat 6 and 7.

http://svn.apache.org/repos/asf/tomcat/tc7.0.x/tags/TOMCAT_7_0_8/java/org/apache/catalina/loader/WebappClassLoader.java

This is called BruteForce cleanup because it uses reflection to reach into the innards of the ThreadLocal class and to directly remove the per Thread mapping of values.

This class is intended to be called at the end of your ServletContext to cleanup any thread locals that are lying around before Tomcat warns you about them and rightly worried customers start raising support requests and we burn cash looking into an issue that we could have avoided..


Constructor Summary
BruteForceThreadLocalCleanup()
           
 
Method Summary
static void cleanUp(java.lang.ClassLoader webAppClassLoader)
          Can be called to cleanup ThreadLocals for the specified class loader
static void cleanUp(java.lang.ClassLoader webAppClassLoader, java.lang.Thread targetThread)
           
static boolean isDevMode()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BruteForceThreadLocalCleanup

public BruteForceThreadLocalCleanup()
Method Detail

cleanUp

public static void cleanUp(java.lang.ClassLoader webAppClassLoader)
Can be called to cleanup ThreadLocals for the specified class loader

Parameters:
webAppClassLoader - the class loader to clean up ThreadLocals on

cleanUp

public static void cleanUp(java.lang.ClassLoader webAppClassLoader,
                           java.lang.Thread targetThread)

isDevMode

public static boolean isDevMode()


Copyright © 2013 Atlassian. All Rights Reserved.