You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Paulsen, Jay" <ja...@uiowa.edu> on 2004/09/23 16:54:17 UTC

WebappClassLoader not garbage collected if web app used java.beans.Introspector

The java.beans.Introspector class keeps a static reference to a cache of
BeanInfo classes.  From the javadoc for Introspector:

 * Because the Introspector caches BeanInfo classes for better
performance, 
 * take care if you use it in an application that uses
 * multiple class loaders.
 * In general, when you destroy a <code>ClassLoader</code>
 * that has been used to introspect classes,
 * you should use the
 * {@link #flushCaches <code>Introspector.flushCaches</code>} 
 * or 
 * {@link #flushFromCaches <code>Introspector.flushFromCaches</code>}
method
 * to flush all of the introspected classes out of the cache.


A web app that uses log4j or any code that uses Introspector will not
allow the classloader to be garbage collected without a call
Introspector.flushCaches().  See these threads on the log4j mailing list
for the original context of this problem.

http://www.mail-archive.com/log4j-user%40logging.apache.org/msg01908.htm
l
http://www.mail-archive.com/log4j-user%40logging.apache.org/msg01898.htm
l



Instead of requiring the web app to call flushCaches, could Tomcat do it
when it shutsdown the webapp and discards the classloader?


-Jay

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org