public class ASURLClassLoader extends URLClassLoader implements JasperAdapter, org.glassfish.api.deployment.InstrumentableClassLoader, org.glassfish.hk2.api.PreDestroy, DDPermissionsLoader
| Modifier and Type | Class and Description |
|---|---|
protected class |
ASURLClassLoader.SentinelInputStream
Wraps all InputStreams returned by this class loader to report when
a finalizer is run before the stream has been closed.
|
protected static class |
ASURLClassLoader.URLEntry
URL entry - keeps track of the url resources.
|
SET_EE_POLICY| Constructor and Description |
|---|
ASURLClassLoader()
Constructor.
|
ASURLClassLoader(ClassLoader parent)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDeclaredPermissions(PermissionCollection declaredPc)
Pass the declared permission collection from the module handler to the classloader
|
void |
addEEPermissions(PermissionCollection eePc)
Pass the EE permission to the classloader
|
void |
addTransformer(ClassFileTransformer transformer) |
void |
addURL(URL url)
Appends the specified URL to the list of URLs to search for
classes and resources.
|
void |
appendURL(File file)
Adds a URL to the search list, based on the specified File.
|
void |
appendURL(URL url)
Add a url to the list of urls we search for a class's bytecodes.
|
ClassLoader |
copy()
Create a new instance of a sibling classloader
|
void |
done()
This method should be called to free up the resources.
|
protected Class |
findClass(String name)
THREAD SAFETY: what happens when more than one thread requests the same class
and thus works on the same classData? Or defines the same package? Maybe
the same work just gets done twice, and that's all.
|
protected com.sun.enterprise.loader.ASURLClassLoader.ClassData |
findClassData(String name)
This method is responsible for locating the url from the class bytes
have to be read and reading the bytes.
|
URL |
findResource(String name) |
Enumeration<URL> |
findResources(String name)
Returns an enumeration of java.net.URL objects
representing all the resources with the given name.
|
protected String |
getClassLoaderName() |
String |
getClasspath()
Returns all the "file" protocol resources of this ASURLClassLoader,
concatenated to a classpath string.
|
protected PermissionCollection |
getPermissions(CodeSource codeSource) |
InputStream |
getResourceAsStream(String name) |
URL[] |
getURLs()
Returns the urls of this class loader.
|
boolean |
isDone() |
void |
preDestroy() |
void |
refresh()
Refreshes the memory of the class loader.
|
String |
toString()
Returns a string representation of this class loader.
|
close, definePackage, newInstance, newInstancedefineClass, defineClassclearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSignerspublic ASURLClassLoader()
public ASURLClassLoader(ClassLoader parent)
parent - parent class loaderpublic boolean isDone()
public void preDestroy()
preDestroy in interface org.glassfish.hk2.api.PreDestroypublic void done()
public void appendURL(File file) throws IOException
This variant of the method makes sure that the URL is valid, in particular encoding special characters (such as blanks) in the file path.
file - the File to use in creating the URLIOException - in case of errors converting the file to a URLpublic void addURL(URL url)
addURL in class URLClassLoaderurl - the URL to be added to the search path of URLspublic void appendURL(URL url)
url - url to be addedpublic URL[] getURLs()
getURLs in interface JasperAdaptergetURLs in class URLClassLoaderpublic String getClasspath()
public void refresh()
throws IOException
Code that creates an ASURLClassLoader and then adds files to a directory that is in the loader's classpath should invoke this method after the new file(s) have been added in order to update the class loader's data structures which optimize class and resource searches.
IOException - in case of errors refreshing the cachepublic void addTransformer(ClassFileTransformer transformer)
addTransformer in interface org.glassfish.api.deployment.InstrumentableClassLoaderpublic ClassLoader copy()
copy in interface org.glassfish.api.deployment.InstrumentableClassLoaderpublic URL findResource(String name)
findResource in class URLClassLoaderpublic Enumeration<URL> findResources(String name) throws IOException
findResources in class URLClassLoaderIOExceptionpublic void addEEPermissions(PermissionCollection eePc) throws SecurityException
DDPermissionsLoaderaddEEPermissions in interface DDPermissionsLoadereePc - EE permissions
throws AccessControlException if caller has no privilegeSecurityExceptionpublic void addDeclaredPermissions(PermissionCollection declaredPc) throws SecurityException
DDPermissionsLoaderaddDeclaredPermissions in interface DDPermissionsLoaderdeclaredPc - the declared permission collection obtained from permissions.xml file
throws AccessControlException if caller has no privilegeSecurityExceptionprotected PermissionCollection getPermissions(CodeSource codeSource)
getPermissions in class URLClassLoaderprotected Class findClass(String name) throws ClassNotFoundException
findClass in class URLClassLoaderClassNotFoundExceptionprotected com.sun.enterprise.loader.ASURLClassLoader.ClassData findClassData(String name) throws ClassNotFoundException
To preclude a race condition on checking 'doneCalled', as well as transient errors if done() is called while running, this method is 'synchronized'.
name - class name in java.lang.Object formatClassNotFoundExceptionprotected String getClassLoaderName()
public String toString()
public InputStream getResourceAsStream(String name)
getResourceAsStream in class URLClassLoaderCopyright © 2017–2020 Eclipse Foundation. All rights reserved.