Vadim Gritsenko wrote:
> ... or ThreadLocals are EVIL! If you have not heard the word yet,
> ThreadLocals
> tend to prevent (web) application(s) from being garbage collected when thread
> locals are not properly nulled out.
Yepp, we had to fix such a ThreadLocal in Xalan recently which eat up
3GB of memory in four hours! With the ThreadLocal properly reset, the
app runs at an average of 300MB...
>
> So in order to allow web applications using LogKit to be properly unloaded,
> LogKit's ContextMap has to have one more method:
>
> /**
> * Remove current ContextMap.
> * This method removes a ContextMap associated with current thread,
> * if there is any.
> */
> public static void removeCurrentContext()
> {
> c_localContext.set(null);
> }
>
>
> 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.
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]