Public Member Functions | Static Public Attributes | Protected Member Functions

alma.acs.classloading.AcsComponentClassLoader Class Reference

Inherits java::net::URLClassLoader.

List of all members.

Public Member Functions

 AcsComponentClassLoader (ClassLoader parent, Logger logger, String componentName)
String getSourceObject ()
String getProcessName ()
void close () throws IOException

Static Public Attributes

static final String PROPERTY_JARDIRS = "acs.components.classpath.jardirs"
static final String PROPERTY_CLASSLOADERVERBOSE = "acs.components.classloader.verbose"

Protected Member Functions

synchronized Class<?> loadClass (String name, boolean resolve) throws ClassNotFoundException
Class<?> findClass (String name) throws ClassNotFoundException
void finalize () throws Throwable

Detailed Description

The component-specific class loader. Attempts to load classes directly, and only delegates to parent class loader after it failed. This bottom-up direction of classloading in the classloader hierarchy follows the J2EE convention, and thus violates the normal J2SE top-down direction.

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.

TODO-: this class has a few things in common with alma.acs.classloading.AcsSystemClassLoader, so perhaps during some future refactoring a common base class could be extracted (between URLClassLoader and these).


Constructor & Destructor Documentation

alma.acs.classloading.AcsComponentClassLoader.AcsComponentClassLoader ( ClassLoader  parent,
Logger  logger,
String  componentName 
)
Parameters:
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 mode

References alma.acs.makesupport.AcsFileFinder.getAllFiles(), alma.acs.classloading.AcsComponentClassLoader.PROPERTY_CLASSLOADERVERBOSE, alma.acs.classloading.AcsComponentClassLoader.PROPERTY_JARDIRS, and alma.acs.makesupport.AcsFileFinder.setVerbose().


Member Function Documentation

void alma.acs.classloading.AcsComponentClassLoader.close (  )  throws IOException

This method will be added to URLClassLoader in JDK 1.7. Until then, we do something similar already with JDK 1.6.

: Test / remove this once we use JDK 1.7

Since:
ACS 9.1

References alma.acs.classloading.ClassLoaderUtil.releaseLoader().

void alma.acs.classloading.AcsComponentClassLoader.finalize (  )  throws Throwable [protected]
Class<?> alma.acs.classloading.AcsComponentClassLoader.findClass ( String  name  )  throws ClassNotFoundException [protected]

Calls super.findClass(name) and provides some System.out logging if in verbose mode.

See also:
java.lang.ClassLoader.findClass(java.lang.String)

Referenced by alma.acs.classloading.AcsComponentClassLoader.loadClass().

String alma.acs.classloading.AcsComponentClassLoader.getProcessName (  ) 

Taken from ClientLogManager.stripKnownLoggerNamespacePrefix(). Maybe it should be nice to generalize it and put it somewhere else. Strips the prepended constants 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.

logger namespace for CORBA classes (ORB, POAs, etc)

logger namespace for container classes during operation

parent of logger namespaces for application components

String alma.acs.classloading.AcsComponentClassLoader.getSourceObject (  ) 
synchronized Class<?> alma.acs.classloading.AcsComponentClassLoader.loadClass ( String  name,
boolean  resolve 
) throws ClassNotFoundException [protected]

Attempts to load the given class, and only delegates to parent class loader if it failed. This bottom-up direction of classloading in the classloader hierarchy resembles the J2EE convention, and thus violates the normal J2SE top-down direction.

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.

See also:
java.lang.ClassLoader.loadClass(java.lang.String, boolean)

References alma.acs.classloading.AcsComponentClassLoader.findClass().


Member Data Documentation

final String alma.acs.classloading.AcsComponentClassLoader.PROPERTY_CLASSLOADERVERBOSE = "acs.components.classloader.verbose" [static]

Name of the property that flags verbose mode of the component classloader. Verbose mode is a debugging tool, only to be enabled locally by defining this property.

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.

Referenced by alma.acs.classloading.AcsComponentClassLoader.AcsComponentClassLoader().

final String alma.acs.classloading.AcsComponentClassLoader.PROPERTY_JARDIRS = "acs.components.classpath.jardirs" [static]

Name of the property that defines the directories for component implementation jar files. Example value: ../lib/ACScomponents:/alma/ACS-5.0/ACSSW/lib/ACScomponents:".

Referenced by alma.acs.classloading.AcsComponentClassLoader.AcsComponentClassLoader().


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