Class ConnectorClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- java.security.SecureClassLoader
-
- java.net.URLClassLoader
-
- com.sun.enterprise.loader.CurrentBeforeParentClassLoader
-
- com.sun.enterprise.loader.ASURLClassLoader
-
- com.sun.enterprise.connectors.util.ConnectorClassLoader
-
- All Implemented Interfaces:
JasperAdapter
,DDPermissionsLoader
,Closeable
,AutoCloseable
,InstrumentableClassLoader
,org.glassfish.hk2.api.PreDestroy
public class ConnectorClassLoader extends ASURLClassLoader
This class loader is responsible for loading standalone RAR files. This class loader is the parent of JarClassLoader (the application class loader)- Author:
- Tony Ng, Sivakumar Thyagarajan
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.sun.enterprise.loader.ASURLClassLoader
ASURLClassLoader.SentinelInputStream, ASURLClassLoader.URLEntry
-
-
Field Summary
-
Fields inherited from class com.sun.enterprise.loader.CurrentBeforeParentClassLoader
currentBeforeParentEnabled, PARENT_CLASSLOADER_DELEGATE_PROPERTY
-
Fields inherited from interface com.sun.enterprise.security.integration.DDPermissionsLoader
SET_EE_POLICY
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addResourceAdapter(String rarName, String moduleDir)
Adds the requested resource adapter to the ConnectorClassLoader.String
getClasspath()
Returns all the resources of the connector classloaders in the chain, concatenated to a classpath string.static ConnectorClassLoader
getInstance()
static ConnectorClassLoader
getInstance(ClassLoader parent)
Initializes this singleton with the given parent class loader if not already created.Class
loadClass(String name, boolean resolve)
Local-first class loading, instead of parent-first as the ClassLoader.loadClass() doesvoid
removeResourceAdapter(String moduleName)
Removes the resource adapter's class loader from the classloader linked list-
Methods inherited from class com.sun.enterprise.loader.ASURLClassLoader
addDeclaredPermissions, addEEPermissions, addTransformer, addURL, appendURL, appendURL, copy, done, findClass, findClassData, findResource, findResources, getClassLoaderName, getPermissions, getResourceAsStream, getURLs, isDone, mustLoadFrom, preDestroy, refresh, toString
-
Methods inherited from class com.sun.enterprise.loader.CurrentBeforeParentClassLoader
disableCurrentBeforeParent, enableCurrentBeforeParent, enableCurrentBeforeParentUnconditional, isWhiteListed, isWhitelistEnabled
-
Methods inherited from class java.net.URLClassLoader
close, definePackage, newInstance, newInstance
-
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Method Detail
-
getInstance
public static ConnectorClassLoader getInstance()
-
getInstance
public static ConnectorClassLoader getInstance(ClassLoader parent)
Initializes this singleton with the given parent class loader if not already created.- Parameters:
parent
- parent class loader- Returns:
- the instance
-
addResourceAdapter
public void addResourceAdapter(String rarName, String moduleDir)
Adds the requested resource adapter to the ConnectorClassLoader. A ConnectorClassLoader is created with the moduleDir as its search path and this classloader is added to the classloader chain.- Parameters:
rarName
- the resourceAdapter module name to addmoduleDir
- the directory location where the RAR contents are exploded
-
removeResourceAdapter
public void removeResourceAdapter(String moduleName)
Removes the resource adapter's class loader from the classloader linked list- Parameters:
moduleName
- the connector module that needs to be removed.
-
loadClass
public Class loadClass(String name, boolean resolve) throws ClassNotFoundException
Description copied from class:CurrentBeforeParentClassLoader
Local-first class loading, instead of parent-first as the ClassLoader.loadClass() does- Overrides:
loadClass
in classCurrentBeforeParentClassLoader
- Returns:
- Loaded class
- Throws:
ClassNotFoundException
-
getClasspath
public String getClasspath()
Returns all the resources of the connector classloaders in the chain, concatenated to a classpath string. Notice that this method is called by the setClassPath() method of org.apache.catalina.loader.WebappLoader, since the ConnectorClassLoader does not extend off of URLClassLoader.- Overrides:
getClasspath
in classASURLClassLoader
- Returns:
- Classpath string containing all the resources of the connectors in the chain. An empty string if there exists no connectors in the chain.
-
-