On Thu, Apr 1, 2010 at 10:55 PM, Clinton Begin <clinton.be...@gmail.com>wrote:

> This is a known issue.  I agree that it would be nice to do something with
> it. Ideas are welcome.   The only one I have at the moment is to make
> ClassInfo an instance and inject it into the SQL mapper configuration.  I've
> done similar things to eliminate static classes in the framework.


A ClassInfo.release(ClassLoader) method that releases all cached information
for classes loaded by the specified class loader might do it. Commons
logging has something like this on LogFactory, although commons logging is
probably not what you want to be using as a model for how to do this right (
http://articles.qos.ch/classloader.html). Commons logging also uses its own
internal weak hash map implementation to avoid holding hard references to
cached loggers. Using something similar might be a bit better, in that no
explicit release is needed when the webapp context is destroyed.

You can call ClassInfo.setCacheEnabled(false); to stop it from caching
> classes.
>

How much of a performance penalty will this cause? I don't have any problems
with the cache while the classloader is live but clearing it when the
classloader dies would be good. ;)

Cheers,
Derek

Reply via email to