ModuleClassLoader
public abstract class ConcurrentClassLoader extends NamedClassLoader
Modifier and Type | Field | Description |
---|---|---|
protected static java.util.Enumeration<java.net.URL> |
EMPTY_ENUMERATION |
An empty enumeration, for subclasses to use if desired.
|
Modifier | Constructor | Description |
---|---|---|
protected |
ConcurrentClassLoader() |
Construct a new instance, using our class loader as the parent.
|
protected |
ConcurrentClassLoader(java.lang.String name) |
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. |
protected |
ConcurrentClassLoader(ConcurrentClassLoader parent,
java.lang.String name) |
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. |
Modifier and Type | Method | Description |
---|---|---|
protected java.lang.Class<?> |
defineOrLoadClass(java.lang.String className,
byte[] bytes,
int off,
int len) |
Atomically define or load the named class.
|
protected java.lang.Class<?> |
defineOrLoadClass(java.lang.String className,
byte[] bytes,
int off,
int len,
java.security.ProtectionDomain protectionDomain) |
Atomically define or load the named class.
|
protected java.lang.Package |
definePackage(java.lang.String name,
java.lang.String specTitle,
java.lang.String specVersion,
java.lang.String specVendor,
java.lang.String implTitle,
java.lang.String implVersion,
java.lang.String implVendor,
java.net.URL sealBase) |
Defines a package by name in this ConcurrentClassLoader.
|
protected java.lang.Class<?> |
findClass(java.lang.String className) |
Implementation of
ClassLoader.findClass(String) . |
protected java.lang.Class<?> |
findClass(java.lang.String className,
boolean exportsOnly,
boolean resolve) |
Find a class, possibly delegating to other loader(s).
|
protected java.lang.Class<?> |
findClass(java.lang.String moduleName,
java.lang.String className) |
Implementation of
ClassLoader.findClass(String, String) . |
protected java.lang.Package |
findLoadedPackage(java.lang.String name) |
Load a package from this class loader only.
|
protected java.net.URL |
findResource(java.lang.String name) |
Never used.
|
protected java.net.URL |
findResource(java.lang.String name,
boolean exportsOnly) |
Find the resource with the given name and exported status.
|
protected java.net.URL |
findResource(java.lang.String moduleName,
java.lang.String name) |
Find the resource with the given name in specified java module.
|
protected java.io.InputStream |
findResourceAsStream(java.lang.String name,
boolean exportsOnly) |
Finds the resource with the given name and exported status, returning the resource content as a stream.
|
protected java.util.Enumeration<java.net.URL> |
findResources(java.lang.String name) |
Never used.
|
protected java.util.Enumeration<java.net.URL> |
findResources(java.lang.String name,
boolean exportsOnly) |
Finds the resources with the given name and exported status.
|
protected java.lang.Package |
getPackage(java.lang.String name) |
Load a package which is visible to this class loader.
|
protected java.lang.Package |
getPackageByName(java.lang.String name) |
Perform the actual work to load a package which is visible to this class loader.
|
protected java.lang.Package[] |
getPackages() |
Get all defined packages which are visible to this class loader.
|
java.net.URL |
getResource(java.lang.String name) |
Finds the resource with the given name.
|
java.io.InputStream |
getResourceAsStream(java.lang.String name) |
Returns an input stream for reading the specified resource.
|
java.util.Enumeration<java.net.URL> |
getResources(java.lang.String name) |
Finds all available resources with the given name.
|
java.lang.Class<?> |
loadClass(java.lang.String className) |
Loads the class with the specified binary name.
|
java.lang.Class<?> |
loadClass(java.lang.String className,
boolean resolve) |
Loads the class with the specified binary name.
|
java.lang.Class<?> |
loadExportedClass(java.lang.String className) |
Same as
loadClass(String) , except only exported classes will be considered. |
java.lang.Class<?> |
loadExportedClass(java.lang.String className,
boolean resolve) |
Same as
loadClass(String,boolean) , except only exported classes will be considered. |
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getParent, getPlatformClassLoader, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
getName
protected static final java.util.Enumeration<java.net.URL> EMPTY_ENUMERATION
protected ConcurrentClassLoader(ConcurrentClassLoader parent)
null
to create a root concurrent class loader.parent
- the parent class loaderprotected ConcurrentClassLoader()
protected ConcurrentClassLoader(ConcurrentClassLoader parent, java.lang.String name)
null
to create a root concurrent class loader.parent
- the parent class loadername
- the name of this class loader, or null
if it is unnamedprotected ConcurrentClassLoader(java.lang.String name)
name
- the name of this class loader, or null
if it is unnamedpublic final java.lang.Class<?> loadClass(java.lang.String className) throws java.lang.ClassNotFoundException
loadClass(className, false)
.loadClass
in class java.lang.ClassLoader
className
- The binary name of the classClass
instancejava.lang.ClassNotFoundException
- if the class was not foundpublic final java.lang.Class<?> loadClass(java.lang.String className, boolean resolve) throws java.lang.ClassNotFoundException
loadClass
in class java.lang.ClassLoader
className
- The binary name of the classresolve
- true
if the class should be linked after loadingClass
instancejava.lang.ClassNotFoundException
public final java.lang.Class<?> loadExportedClass(java.lang.String className) throws java.lang.ClassNotFoundException
loadClass(String)
, except only exported classes will be considered.className
- the class namejava.lang.ClassNotFoundException
- if the class isn't foundpublic final java.lang.Class<?> loadExportedClass(java.lang.String className, boolean resolve) throws java.lang.ClassNotFoundException
loadClass(String,boolean)
, except only exported classes will be considered.className
- the class nameresolve
- true
if the class should be linked after loadingjava.lang.ClassNotFoundException
- if the class isn't foundprotected java.lang.Class<?> findClass(java.lang.String className, boolean exportsOnly, boolean resolve) throws java.lang.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 loadingjava.lang.ClassNotFoundException
- if the class is not foundprotected final java.lang.Class<?> defineOrLoadClass(java.lang.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 classprotected final java.lang.Class<?> defineOrLoadClass(java.lang.String className, byte[] bytes, int off, int len, java.security.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 classprotected final java.lang.Class<?> findClass(java.lang.String className) throws java.lang.ClassNotFoundException
ClassLoader.findClass(String)
.findClass
in class java.lang.ClassLoader
className
- the class namefindClass(className, false, false)
java.lang.ClassNotFoundException
protected final java.lang.Class<?> findClass(java.lang.String moduleName, java.lang.String className)
ClassLoader.findClass(String, String)
.findClass
in class java.lang.ClassLoader
moduleName
- the Java module nameclassName
- the class namefindClass(className, false, false)
public final java.net.URL getResource(java.lang.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 java.lang.ClassLoader
name
- the name of the resourcenull
if no such resource exists or the invoker does not have adequate
permission to access itpublic final java.util.Enumeration<java.net.URL> getResources(java.lang.String name) throws java.io.IOException
getResources
in class java.lang.ClassLoader
name
- the resource namejava.io.IOException
- if an I/O error occursgetResource(String)
protected java.net.URL findResource(java.lang.String name, boolean exportsOnly)
name
- the resource nameexportsOnly
- true
to consider only exported resources or false
to consider all resourcesgetResource(String)
protected final java.net.URL findResource(java.lang.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 java.lang.ClassLoader
name
- ignorednull
alwaysprotected final java.net.URL findResource(java.lang.String moduleName, java.lang.String name) throws java.io.IOException
findResource
in class java.lang.ClassLoader
moduleName
- java module namename
- the resource namejava.io.IOException
getResource(String)
protected java.util.Enumeration<java.net.URL> findResources(java.lang.String name, boolean exportsOnly) throws java.io.IOException
name
- the resource nameexportsOnly
- true
to consider only exported resources or false
to consider all resourcesjava.io.IOException
- if an I/O error occursgetResources(String)
protected final java.util.Enumeration<java.net.URL> findResources(java.lang.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 java.lang.ClassLoader
name
- ignoredprotected java.io.InputStream findResourceAsStream(java.lang.String name, boolean exportsOnly)
name
- the resource nameexportsOnly
- true
to consider only exported resources or false
to consider all resourcesnull
if the resource is not foundpublic final java.io.InputStream getResourceAsStream(java.lang.String name)
findResourceAsStream(String, boolean)
.getResourceAsStream
in class java.lang.ClassLoader
name
- the resource namenull
if the resource is not foundprotected final java.lang.Package getPackage(java.lang.String name)
getPackage
in class java.lang.ClassLoader
name
- the package namenull
if no such package is visible to this class loaderprotected java.lang.Package getPackageByName(java.lang.String name)
name
- the package namenull
if no such package is visible to this class loaderprotected java.lang.Package[] getPackages()
getPackages
in class java.lang.ClassLoader
protected final java.lang.Package findLoadedPackage(java.lang.String name)
name
- the package namenull
if no such package is defined by this class loaderprotected java.lang.Package definePackage(java.lang.String name, java.lang.String specTitle, java.lang.String specVersion, java.lang.String specVendor, java.lang.String implTitle, java.lang.String implVersion, java.lang.String implVendor, java.net.URL sealBase) throws java.lang.IllegalArgumentException
definePackage
in class java.lang.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 URLjava.lang.IllegalArgumentException
Copyright © 2022 JBoss by Red Hat. All rights reserved.