|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
com.sun.enterprise.loader.ASURLClassLoader
public class ASURLClassLoader
Class loader used by the ejbs of an application or stand alone module. This class loader also keeps cache of not found classes and resources.
| Nested Class Summary | |
|---|---|
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. |
| Constructor Summary | |
|---|---|
ASURLClassLoader()
Constructor. |
|
ASURLClassLoader(java.lang.ClassLoader parent)
Constructor. |
|
| Method Summary | |
|---|---|
void |
addTransformer(java.lang.instrument.ClassFileTransformer transformer)
|
void |
addURL(java.net.URL url)
Appends the specified URL to the list of URLs to search for classes and resources. |
void |
appendURL(java.io.File file)
Adds a URL to the search list, based on the specified File. |
void |
appendURL(java.net.URL url)
Add a url to the list of urls we search for a class's bytecodes. |
java.lang.ClassLoader |
copy()
Create a new instance of a sibling classloader |
void |
done()
This method should be called to free up the resources. |
protected java.lang.Class |
findClass(java.lang.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(java.lang.String name)
This method is responsible for locating the url from the class bytes have to be read and reading the bytes. |
java.net.URL |
findResource(java.lang.String name)
|
java.util.Enumeration<java.net.URL> |
findResources(java.lang.String name)
Returns an enumeration of java.net.URL objects representing all the resources with the given name. |
protected java.lang.String |
getClassLoaderName()
|
java.lang.String |
getClasspath()
Returns all the "file" protocol resources of this ASURLClassLoader, concatenated to a classpath string. |
java.io.InputStream |
getResourceAsStream(java.lang.String name)
|
java.net.URL[] |
getURLs()
Returns the urls of this class loader. |
boolean |
isDone()
|
void |
preDestroy()
|
void |
refresh()
Refreshes the memory of the class loader. |
java.lang.String |
toString()
Returns a string representation of this class loader. |
| Methods inherited from class java.net.URLClassLoader |
|---|
definePackage, getPermissions, newInstance, newInstance |
| Methods inherited from class java.security.SecureClassLoader |
|---|
defineClass, defineClass |
| Methods inherited from class java.lang.ClassLoader |
|---|
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ASURLClassLoader()
public ASURLClassLoader(java.lang.ClassLoader parent)
parent - parent class loader| Method Detail |
|---|
public boolean isDone()
public void preDestroy()
preDestroy in interface org.jvnet.hk2.component.PreDestroypublic void done()
public void appendURL(java.io.File file)
throws java.io.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 URL
java.io.IOException - in case of errors converting the file to a URLpublic void addURL(java.net.URL url)
addURL in class java.net.URLClassLoaderurl - the URL to be added to the search path of URLspublic void appendURL(java.net.URL url)
url - url to be addedpublic java.net.URL[] getURLs()
getURLs in interface JasperAdaptergetURLs in class java.net.URLClassLoaderpublic java.lang.String getClasspath()
public void refresh()
throws java.io.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.
java.io.IOException - in case of errors refreshing the cachepublic void addTransformer(java.lang.instrument.ClassFileTransformer transformer)
addTransformer in interface InstrumentableClassLoaderpublic java.lang.ClassLoader copy()
copy in interface InstrumentableClassLoaderpublic java.net.URL findResource(java.lang.String name)
findResource in class java.net.URLClassLoader
public java.util.Enumeration<java.net.URL> findResources(java.lang.String name)
throws java.io.IOException
findResources in class java.net.URLClassLoaderjava.io.IOException
protected java.lang.Class findClass(java.lang.String name)
throws java.lang.ClassNotFoundException
findClass in class java.net.URLClassLoaderjava.lang.ClassNotFoundException
protected com.sun.enterprise.loader.ASURLClassLoader.ClassData findClassData(java.lang.String name)
throws java.lang.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 format
java.lang.ClassNotFoundExceptionprotected java.lang.String getClassLoaderName()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.io.InputStream getResourceAsStream(java.lang.String name)
getResourceAsStream in class java.lang.ClassLoader
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||