public class AcsComponentClassLoader
extends java.net.URLClassLoader
This class requires the directories that contain component impl jars to be specified in the acs.components.classpath.jardirs
property.
The startup scripts must set this property.
Other jar files (e.g. ACS jars) must be in different directories than those given by this property.
It is important to call the close() method when done with the classloader.
Since ACS 12.3 (JDK 1.7) this method is provided by the base class.
After changes in this area, make sure to manually run AcsComponentClassLoaderEnduranceTest to verify
that there are no memory problems (non-heap OutOfMemoryError) as were seen in the past
(http://jira.alma.cl/browse/COMP-4929).
TODO-: this class has a few things in common with AcsSystemClassLoader, so
perhaps during some future refactoring a common base class could be extracted (between URLClassLoader and these).
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PROPERTY_CLASSLOADERVERBOSE
Name of the property that flags verbose mode of the component classloader.
|
static java.lang.String |
PROPERTY_JARDIRS
Name of the property that defines the directories for component implementation jar files.
|
| Constructor and Description |
|---|
AcsComponentClassLoader(java.lang.ClassLoader parent,
java.util.logging.Logger logger,
java.lang.String componentName) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
finalize() |
protected java.lang.Class<?> |
findClass(java.lang.String name)
Calls
super.findClass(name) and provides some System.out logging if in verbose mode. |
java.lang.String |
getProcessName()
Taken from ClientLogManager.stripKnownLoggerNamespacePrefix().
|
java.lang.String |
getSourceObject() |
protected java.lang.Class<?> |
loadClass(java.lang.String name,
boolean resolve)
Attempts to load the given class, and only delegates to parent class loader if it failed.
|
addURL, close, definePackage, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstanceclearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSignerspublic static final java.lang.String PROPERTY_JARDIRS
../lib/ACScomponents:/alma/ACS-5.0/ACSSW/lib/ACScomponents:".public static final java.lang.String PROPERTY_CLASSLOADERVERBOSE
If enabled to be verbose, a component classloader will log the jar files it works with, the classes it loads or fails to load, and also prints a message when it is getting finalized. The latter is useful to monitor component class unloading.
public AcsComponentClassLoader(java.lang.ClassLoader parent,
java.util.logging.Logger logger,
java.lang.String componentName)
parent - parent class loader (currently the container class loader)logger - the container logger, for debug output (see PROPERTY_CLASSLOADERVERBOSE).
This is also used to derive the processName when logging exceptions.componentName - used for log messages in verbose modeprotected java.lang.Class<?> loadClass(java.lang.String name,
boolean resolve)
throws java.lang.ClassNotFoundException
TODO-: check if certain system or ACS classes should be skipped and delegated upward right away.
This may improve performance, assuming a bunch of name.startsWith("java.") etc are faster than
findLoadedClass and findClass.
loadClass in class java.lang.ClassLoaderjava.lang.ClassNotFoundExceptionClassLoader.loadClass(java.lang.String, boolean)protected java.lang.Class<?> findClass(java.lang.String name)
throws java.lang.ClassNotFoundException
super.findClass(name) and provides some System.out logging if in verbose mode.findClass in class java.net.URLClassLoaderjava.lang.ClassNotFoundExceptionClassLoader.findClass(java.lang.String)protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic java.lang.String getSourceObject()
ContextFinderpublic java.lang.String getProcessName()
#NS_CORBA, #NS_CONTAINER, #NS_COMPONENT etc from the logger namespace.
This allows for a short, but possibly not unique display of the logger name.
TODO: This method is probably broken and must be checked. We may just pass contextName in the ctor.
ContextFinder