excalibur-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <va...@reverycodes.com>
Subject Re: One more change to be included into the release...
Date Wed, 24 Aug 2005 12:27:33 GMT
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.


[1] http://www.jroller.com/page/tackline?entry=fixing_threadlocal

To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org

View raw message