|
||||||||||
| 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(ClassLoader parent)
Constructor. |
|
| Method Summary | |
|---|---|
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. |
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. |
| 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.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ASURLClassLoader()
public ASURLClassLoader(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(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 URL
IOException - 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 InstrumentableClassLoaderpublic ClassLoader copy()
copy in interface InstrumentableClassLoaderpublic URL findResource(String name)
findResource in class URLClassLoader
public Enumeration<URL> findResources(String name)
throws IOException
findResources in class URLClassLoaderIOException
protected Class findClass(String name)
throws ClassNotFoundException
findClass in class URLClassLoaderClassNotFoundException
protected 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 format
ClassNotFoundExceptionprotected String getClassLoaderName()
public String toString()
toString in class Objectpublic InputStream getResourceAsStream(String name)
getResourceAsStream in class ClassLoader
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||