Public Member Functions

alma.acs.classloading.ClassLoaderUtil Class Reference

List of all members.

Public Member Functions

 ClassLoaderUtil (Logger logger) throws NoSuchFieldException
void releaseLoader (URLClassLoader classLoader)
IOException[] releaseLoader (URLClassLoader classLoader, Vector< String > jarsClosed)

Detailed Description

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.

Author:
tjquinn

Constructor & Destructor Documentation

alma.acs.classloading.ClassLoaderUtil.ClassLoaderUtil ( Logger  logger  )  throws NoSuchFieldException
Parameters:
logger The ACS logger, which in the original implementation was retrieved as LogDomains.getLogger(ClassLoaderUtil.class, LogDomains.UTIL_LOGGER).
Exceptions:
NoSuchFieldException 

Member Function Documentation

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.

Parameters:
classLoader the instance of URLClassLoader (or a subclass)
Returns:
array of IOExceptions reporting jars that failed to close

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.

Parameters:
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
Returns:
array of IOExceptions reporting jars that failed to close; null indicates that an error other than an IOException occurred attempting to release the loader; empty indicates a successful release; non-empty indicates at least one error attempting to close an open jar.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties