Public Member Functions | |
ClassLoaderUtil (Logger logger) throws NoSuchFieldException | |
void | releaseLoader (URLClassLoader classLoader) |
IOException[] | releaseLoader (URLClassLoader classLoader, Vector< String > jarsClosed) |
Copied and just slightly modified from com.sun.appserv.ClassLoaderUtil. One reason not to use the similar J2SE class sun.misc.ClassLoaderUtil was its ugly stdout printing of lines like
classLoader = alma.acs.classloading.AcsComponentClassLoader SharedSecrets.getJavaNetAccess()=java.net.URLClassLoader$7
which would disturb TAT tests and users alike. Other assumed benefits of com.sun.appserv.ClassLoaderUtil will still have to be discovered.
Make sure to provide an ACS-enabled logger, in setLogger(Logger).
Below is the original javadoc of com.sun.appserv.ClassLoaderUtil
:
Provides utility functions related to URLClassLoaders or subclasses of it.
W A R N I N G
This class uses undocumented, unpublished, private data structures inside java.net.URLClassLoader and sun.misc.URLClassPath. Use with extreme caution.
alma.acs.classloading.ClassLoaderUtil.ClassLoaderUtil | ( | Logger | logger | ) | throws NoSuchFieldException |
logger | The ACS logger, which in the original implementation was retrieved as LogDomains.getLogger(ClassLoaderUtil.class, LogDomains.UTIL_LOGGER) . |
NoSuchFieldException |
void alma.acs.classloading.ClassLoaderUtil.releaseLoader | ( | URLClassLoader | classLoader | ) |
Releases resources held by the URLClassLoader. Notably, close the jars opened by the loader. This does not prevent the class loader from continuing to return classes it has already resolved.
classLoader | the instance of URLClassLoader (or a subclass) |
Referenced by alma.acs.classloading.AcsComponentClassLoader.close().
IOException [] alma.acs.classloading.ClassLoaderUtil.releaseLoader | ( | URLClassLoader | classLoader, | |
Vector< String > | jarsClosed | |||
) |
Releases resources held by the URLClassLoader. Notably, close the jars opened by the loader. This does not prevent the class loader from continuing to return classes it has alrady resolved although that is not what we intend to happen. Initializes and updates the Vector of jars that have been successfully closed.
Any errors are logged.
classLoader | the instance of URLClassLoader (or a subclass) | |
jarsClosed | a Vector of Strings that will contain the names of jars successfully closed; can be null if the caller does not need the information returned |