Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In this particular case, the leak is detected, a message is logged and internal structures of the JDK (ThreadLocalMap) are modified to remove the reference to the ThreadLocal instance.TODO: add an example of log

No Format

Mar 16, 2010 11:47:24 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type [test.MyThreadLocal] (value [test.MyThreadLocal@4dbb9a58]) and a value of type [test.MyCounter] (value [test.MyCounter@57922f46]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.

Note: this particular leak was actually already cured by previous versions of tomcat, because static references of classes loaded by the webappclassloader are nullified (see later).

...