|
JBoss Modules 1.1.2.GA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ClassLoader
java.security.SecureClassLoader
org.jboss.modules.ConcurrentClassLoader
public abstract class ConcurrentClassLoader
A classloader which can delegate to multiple other classloaders without risk of deadlock. A concurrent class loader should only ever be delegated to by another concurrent class loader; however a concurrent class loader may delegate to a standard hierarchical class loader. In other words, holding a lock on another class loader while invoking a method on this class loader may cause an unexpected deadlock.
Field Summary | |
---|---|
protected static Enumeration<URL> |
EMPTY_ENUMERATION
An empty enumeration, for subclasses to use if desired. |
Constructor Summary | |
---|---|
protected |
ConcurrentClassLoader()
Construct a new instance, using our class loader as the parent. |
protected |
ConcurrentClassLoader(ConcurrentClassLoader parent)
Construct a new instance with the given parent class loader, which must be a concurrent class loader, or null
to create a root concurrent class loader. |
Method Summary | |
---|---|
protected Class<?> |
defineOrLoadClass(String className,
byte[] bytes,
int off,
int len)
Atomically define or load the named class. |
protected Class<?> |
defineOrLoadClass(String className,
byte[] bytes,
int off,
int len,
CodeSource codeSource)
Atomically define or load the named class. |
protected Class<?> |
defineOrLoadClass(String className,
byte[] bytes,
int off,
int len,
ProtectionDomain protectionDomain)
Atomically define or load the named class. |
protected Package |
definePackage(String name,
String specTitle,
String specVersion,
String specVendor,
String implTitle,
String implVersion,
String implVendor,
URL sealBase)
Defines a package by name in this ConcurrentClassLoader. |
protected Class<?> |
findClass(String className)
Implementation of ClassLoader.findClass(String) . |
protected Class<?> |
findClass(String className,
boolean exportsOnly,
boolean resolve)
Find a class, possibly delegating to other loader(s). |
protected Package |
findLoadedPackage(String name)
Load a package from this class loader only. |
protected URL |
findResource(String name)
Never used. |
protected URL |
findResource(String name,
boolean exportsOnly)
Find the resource with the given name and exported status. |
protected InputStream |
findResourceAsStream(String name,
boolean exportsOnly)
Finds the resource with the given name and exported status, returning the resource content as a stream. |
protected Enumeration<URL> |
findResources(String name)
Never used. |
protected Enumeration<URL> |
findResources(String name,
boolean exportsOnly)
Finds the resources with the given name and exported status. |
protected Package |
getPackage(String name)
Load a package which is visible to this class loader. |
protected Package |
getPackageByName(String name)
Perform the actual work to load a package which is visible to this class loader. |
protected Package[] |
getPackages()
Get all defined packages which are visible to this class loader. |
URL |
getResource(String name)
Finds the resource with the given name. |
InputStream |
getResourceAsStream(String name)
Returns an input stream for reading the specified resource. |
Enumeration<URL> |
getResources(String name)
Finds all available resources with the given name. |
Class<?> |
loadClass(String className)
Loads the class with the specified binary name. |
Class<?> |
loadClass(String className,
boolean resolve)
Loads the class with the specified binary name. |
Class<?> |
loadExportedClass(String className)
Same as loadClass(String) , except only exported classes will be considered. |
Class<?> |
loadExportedClass(String className,
boolean resolve)
Same as loadClass(String,boolean) , except only exported classes will be considered. |
Methods inherited from class java.security.SecureClassLoader |
---|
defineClass, defineClass, getPermissions |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Enumeration<URL> EMPTY_ENUMERATION
Constructor Detail |
---|
protected ConcurrentClassLoader(ConcurrentClassLoader parent)
null
to create a root concurrent class loader.
parent
- the parent class loaderprotected ConcurrentClassLoader()
Method Detail |
---|
public final Class<?> loadClass(String className) throws ClassNotFoundException
loadClass(className, false)
.
loadClass
in class ClassLoader
className
- The binary name of the class
Class
instance
ClassNotFoundException
- if the class was not foundpublic final Class<?> loadClass(String className, boolean resolve) throws ClassNotFoundException
loadClass
in class ClassLoader
className
- The binary name of the classresolve
- true
if the class should be linked after loading
Class
instance
ClassNotFoundException
public final Class<?> loadExportedClass(String className) throws ClassNotFoundException
loadClass(String)
, except only exported classes will be considered.
className
- the class name
ClassNotFoundException
- if the class isn't foundpublic final Class<?> loadExportedClass(String className, boolean resolve) throws ClassNotFoundException
loadClass(String,boolean)
, except only exported classes will be considered.
className
- the class nameresolve
- true
if the class should be linked after loading
ClassNotFoundException
- if the class isn't foundprotected Class<?> findClass(String className, boolean exportsOnly, boolean resolve) throws ClassNotFoundException
ClassNotFoundException
.
If a class is to be defined by this method, it should be done via one of the atomic defineOrLoadClass
methods rather than defineClass()
in order to avoid spurious exceptions.
className
- the class nameexportsOnly
- true
if only exported classes should be consideredresolve
- true
if the class should be linked after loading
ClassNotFoundException
- if the class is not foundprotected final Class<?> defineOrLoadClass(String className, byte[] bytes, int off, int len)
className
- the class name to define or loadbytes
- the bytes to use to define the classoff
- the offset into the byte array at which the class bytes beginlen
- the number of bytes in the class
protected final Class<?> defineOrLoadClass(String className, byte[] bytes, int off, int len, CodeSource codeSource)
className
- the class name to define or loadbytes
- the bytes to use to define the classoff
- the offset into the byte array at which the class bytes beginlen
- the number of bytes in the classcodeSource
- the code source for the defined class
protected final Class<?> defineOrLoadClass(String className, byte[] bytes, int off, int len, ProtectionDomain protectionDomain)
className
- the class name to define or loadbytes
- the bytes to use to define the classoff
- the offset into the byte array at which the class bytes beginlen
- the number of bytes in the classprotectionDomain
- the protection domain for the defined class
protected final Class<?> findClass(String className) throws ClassNotFoundException
ClassLoader.findClass(String)
.
findClass
in class ClassLoader
className
- the class name
findClass(className, false, false)
ClassNotFoundException
public final URL getResource(String name)
'/'
-separated path name that
identifies the resource. If the resource name starts with "java/"
then the parent class loader is used.
Otherwise, this method delegates to findResource(String, boolean)
.
getResource
in class ClassLoader
name
- the name of the resource
null
if no such resource exists or the invoker does not have adequate
permission to access itpublic final Enumeration<URL> getResources(String name) throws IOException
getResources
in class ClassLoader
name
- the resource name
IOException
- if an I/O error occursgetResource(String)
protected URL findResource(String name, boolean exportsOnly)
name
- the resource nameexportsOnly
- true
to consider only exported resources or false
to consider all resources
getResource(String)
protected final URL findResource(String name)
ClassLoader.getResource(String)
and related methods can cause a loop condition
when this method is implemented; use findResource(String, boolean)
instead.
findResource
in class ClassLoader
name
- ignored
null
alwaysprotected Enumeration<URL> findResources(String name, boolean exportsOnly) throws IOException
name
- the resource nameexportsOnly
- true
to consider only exported resources or false
to consider all resources
IOException
- if an I/O error occursgetResources(String)
protected final Enumeration<URL> findResources(String name)
ClassLoader.getResources(String)
and related methods can cause a loop condition
when this method is implemented; use findResources(String, boolean)
instead. By default, returns
an empty enumeration.
findResources
in class ClassLoader
name
- ignored
protected InputStream findResourceAsStream(String name, boolean exportsOnly)
name
- the resource nameexportsOnly
- true
to consider only exported resources or false
to consider all resources
null
if the resource is not foundpublic final InputStream getResourceAsStream(String name)
"java/"
, then
this method delegates to the parent class loader. Otherwise, this method delegates to findResourceAsStream(String, boolean)
.
getResourceAsStream
in class ClassLoader
name
- the resource name
null
if the resource is not foundprotected final Package getPackage(String name)
getPackage
in class ClassLoader
name
- the package name
null
if no such package is visible to this class loaderprotected Package getPackageByName(String name)
name
- the package name
null
if no such package is visible to this class loaderprotected Package[] getPackages()
getPackages
in class ClassLoader
protected final Package findLoadedPackage(String name)
name
- the package name
null
if no such package is defined by this class loaderprotected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase) throws IllegalArgumentException
definePackage
in class ClassLoader
name
- the package namespecTitle
- the specification titlespecVersion
- the specification versionspecVendor
- the specification vendorimplTitle
- the implementation titleimplVersion
- the implementation versionimplVendor
- the implementation vendorsealBase
- if not null
, then this package is sealed with respect to the given code source URL
IllegalArgumentException
|
JBoss Modules 1.1.2.GA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |