org.apache.xbean.classloader
Class ClassLoaderUtil

java.lang.Object
  extended by org.apache.xbean.classloader.ClassLoaderUtil

public final class ClassLoaderUtil
extends Object

Utility methods for class loader manipulation in a server environment.

Since:
2.0
Author:
Dain Sundstrom

Method Summary
static void clearSunSoftCache(Class clazz, String fieldName)
          Clears the caches maintained by the SunVM object stream implementation.
static void destroy(ClassLoader classLoader)
          Cleans well known class loader leaks in VMs and libraries.
static void releaseCommonsLoggingCache(ClassLoader classLoader)
          Releases the specified classloader from the Apache Jakarta Commons Logging class loader cache using reflection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

destroy

public static void destroy(ClassLoader classLoader)
Cleans well known class loader leaks in VMs and libraries. There is a lot of bad code out there and this method will clear up the know problems. This method should only be called when the class loader will no longer be used. It this method is called two often it can have a serious impact on preformance.

Parameters:
classLoader - the class loader to destroy

clearSunSoftCache

public static void clearSunSoftCache(Class clazz,
                                     String fieldName)
Clears the caches maintained by the SunVM object stream implementation. This method uses reflection and setAccessable to obtain access to the Sun cache. The cache is locked with a synchronize monitor and cleared. This method completely clears the class loader cache which will impact preformance of object serialization.

Parameters:
clazz - the name of the class containing the cache field
fieldName - the name of the cache field

releaseCommonsLoggingCache

public static void releaseCommonsLoggingCache(ClassLoader classLoader)
Releases the specified classloader from the Apache Jakarta Commons Logging class loader cache using reflection.

Parameters:
classLoader - the class loader to release


Copyright © 2005-2009 Apache Software Foundation. All Rights Reserved.