Package com.sun.enterprise.module.impl
Class ClassLoaderProxy
- java.lang.Object
-
- java.lang.ClassLoader
-
- java.security.SecureClassLoader
-
- java.net.URLClassLoader
-
- com.sun.enterprise.module.impl.ClassLoaderProxy
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class ClassLoaderProxy extends URLClassLoader
ClassLoaderProxy capable of loading classes from itself but also from other class loaders- Author:
- Jerome Dochez
-
-
Constructor Summary
Constructors Constructor Description ClassLoaderProxy(URL[] shared, ClassLoader parent)
Creates a new instance of ClassLoader
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDelegate(ClassLoader cl)
void
addURL(URL url)
Appends the specified URL to the list of URLs to search for classes and resources.protected void
finalize()
protected Class<?>
findClass(String name)
protected Class<?>
findClass(String name, boolean followImports)
URL
findResource(String name)
URL
findResourceDirect(String name)
Works likefindResource(String)
but only looks at this module, without delegating to ancestors.Enumeration<URL>
findResources(String name)
Collection<ClassLoader>
getDelegates()
protected Class<?>
loadClass(String name, boolean resolve, boolean followImports)
void
removeDelegate(ClassLoader cl)
void
stop()
called by the facade class loader when it is garbage collected.String
toString()
-
Methods inherited from class java.net.URLClassLoader
close, definePackage, getPermissions, getResourceAsStream, getURLs, 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, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Constructor Detail
-
ClassLoaderProxy
public ClassLoaderProxy(URL[] shared, ClassLoader parent)
Creates a new instance of ClassLoader
-
-
Method Detail
-
finalize
protected void finalize() throws Throwable
-
loadClass
protected Class<?> loadClass(String name, boolean resolve, boolean followImports) throws ClassNotFoundException
- Throws:
ClassNotFoundException
-
findClass
protected Class<?> findClass(String name) throws ClassNotFoundException
- Overrides:
findClass
in classURLClassLoader
- Throws:
ClassNotFoundException
-
findClass
protected Class<?> findClass(String name, boolean followImports) throws ClassNotFoundException
- Throws:
ClassNotFoundException
-
findResource
public URL findResource(String name)
- Overrides:
findResource
in classURLClassLoader
-
findResourceDirect
public URL findResourceDirect(String name)
Works likefindResource(String)
but only looks at this module, without delegating to ancestors.
-
findResources
public Enumeration<URL> findResources(String name) throws IOException
- Overrides:
findResources
in classURLClassLoader
- Throws:
IOException
-
addDelegate
public void addDelegate(ClassLoader cl)
-
removeDelegate
public void removeDelegate(ClassLoader cl)
-
getDelegates
public Collection<ClassLoader> getDelegates()
-
stop
public void stop()
called by the facade class loader when it is garbage collected. this is a good time to see if this module should be unloaded.
-
addURL
public void addURL(URL url)
Appends the specified URL to the list of URLs to search for classes and resources.- Overrides:
addURL
in classURLClassLoader
- Parameters:
url
- the url to append
-
-