Carsten Ziegeler wrote:
Vadim Gritsenko wrote:
Consistent usage of this method, like:
try {
... ContextMap.getCurrentContext() ...
} finally {
ContextMap.removeCurrentContext();
}
will guarantee that ThreadLocal is properly cleaned up and web app will be
properly unloaded. I'd like to include this addition into the release; and IMHO
there is no reason to do yet another RC build just because of it :-) because it
is simple addition which does not alter any existing behavior.
Hmm, is this really required? The context map has a clear method
clearing all items stored in the map. The only object that is not
removed is the map itself, which shouldn't be a problem.
Of course it is required, and of course it is a problem :-)
Thread (pooled tomcat thread)
--> ThreadLocalMap
--> ThreadLocalMap.Entry
--weak--> ThreadLocal (ContextMap.c_localContext)
-strong-> ContextMap Object
--> ContextMap Class
--> ThreadLocal (c_localContext)
--> WebAppClassLoader (<loader>)
So as you can see there is a strong reference from ContextMap class to the
ThreadLocal which prevents GC of the WebAppClassLoader :-) See also [1] and
referenced BugParade entry.
Vadim
[1] http://www.jroller.com/page/tackline?entry=fixing_threadlocal
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]