|
||||||||||
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. |
protected |
ConcurrentClassLoader(ConcurrentClassLoader parent)
Construct a new instance with the given parent class loader, which must be a concurrent class loader. |
Method Summary | |
---|---|
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 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. |
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)
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
.
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<?> 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 found
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |