Top Description Inners Fields Constructors Methods
com.sun.enterprise.module.impl

public Class ClassLoaderProxy

extends URLClassLoader
Class Inheritance
Known Direct Subclasses
com.sun.enterprise.module.impl.ModuleClassLoader
Imports
com.sun.enterprise.module.common_impl.FlattenEnumeration, java.lang.ref.Cleaner, java.net.URLClassLoader, .URL, java.util.*, java.util.concurrent.CopyOnWriteArrayList, java.util.concurrent.locks.ReentrantLock, java.io.IOException, org.glassfish.hk2.utilities.CleanerFactory

ClassLoaderProxy capable of loading classes from itself but also from other class loaders
Author
Jerome Dochez

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final Cleaner.Cleanable
private final List<ClassLoaderFacade>
private final ReentrantLock
private final List<ClassLoader>

Constructor Summary

AccessConstructor and Description
public
ClassLoaderProxy(URL[] shared, ClassLoader parent)

Creates a new instance of ClassLoader

Method Summary

Modifier and TypeMethod and Description
public void
public void
addURL(URL
the url to append
url
)

Overrides java.net.URLClassLoader.addURL.

Appends the specified URL to the list of URLs to search for classes and resources.

protected Class<?>
findClass(String name)

Overrides java.net.URLClassLoader.findClass.

Finds and loads the class with the specified name from the URL search path.

protected Class<?>
findClass(String name, boolean followImports)

pack-priv Class<T>
findClassDirect(String name)

findClass(String) except the classloader punch-in hack.

public URL
findResource(String name)

Overrides java.net.URLClassLoader.findResource.

Finds the resource with the specified name on the URL search path.

public URL
findResourceDirect(String name)

Works like findResource(String) but only looks at this module, without delegating to ancestors.

public Enumeration<URL>
findResources(String name)

Overrides java.net.URLClassLoader.findResources.

Returns an Enumeration of URLs representing all of the resources on the URL search path having the specified name.

public Collection<ClassLoader>
protected Class<?>
loadClass(String name, boolean resolve, boolean followImports)

public final Cleaner.Cleanable
registerStopEvent()

called by the facade class loader when it is garbage collected.

public void
public void
stop()

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.net.URLClassLoader:
closedefinePackagegetPermissionsgetResourceAsStreamgetURLsnewInstancenewInstance

Field Detail

cleanableback to summary
private final Cleaner.Cleanable cleanable
facadeSurrogatesback to summary
private final List<ClassLoaderFacade> facadeSurrogates
lockback to summary
private final ReentrantLock lock
surrogatesback to summary
private final List<ClassLoader> surrogates

Constructor Detail

ClassLoaderProxyback to summary
public ClassLoaderProxy(URL[] shared, ClassLoader parent)

Creates a new instance of ClassLoader

Method Detail

addDelegateback to summary
public void addDelegate(ClassLoader cl)
addURLback to summary
public void addURL(URL url)

Overrides java.net.URLClassLoader.addURL.

Appends the specified URL to the list of URLs to search for classes and resources.

Parameters
url:URL

the url to append

findClassback to summary
protected Class<?> findClass(String name) throws ClassNotFoundException

Overrides java.net.URLClassLoader.findClass.

Doc from java.net.URLClassLoader.findClass.

Finds and loads the class with the specified name from the URL search path. Any URLs referring to JAR files are loaded and opened as needed until the class is found.

Exceptions
ClassNotFoundException:
if the class could not be found, or if the loader is closed.
findClassback to summary
protected Class<?> findClass(String name, boolean followImports) throws ClassNotFoundException
findClassDirectback to summary
pack-priv Class<T> findClassDirect(String name) throws ClassNotFoundException

findClass(String) except the classloader punch-in hack.

findResourceback to summary
public URL findResource(String name)

Overrides java.net.URLClassLoader.findResource.

Doc from java.net.URLClassLoader.findResource.

Finds the resource with the specified name on the URL search path.

findResourceDirectback to summary
public URL findResourceDirect(String name)

Works like findResource(String) but only looks at this module, without delegating to ancestors.

findResourcesback to summary
public Enumeration<URL> findResources(String name) throws IOException

Overrides java.net.URLClassLoader.findResources.

Doc from java.net.URLClassLoader.findResources.

Returns an Enumeration of URLs representing all of the resources on the URL search path having the specified name.

Exceptions
IOException:
if an I/O exception occurs
getDelegatesback to summary
public Collection<ClassLoader> getDelegates()
loadClassback to summary
protected Class<?> loadClass(String name, boolean resolve, boolean followImports) throws ClassNotFoundException
registerStopEventback to summary
public final Cleaner.Cleanable registerStopEvent()

called by the facade class loader when it is garbage collected. this is a good time to see if this module should be unloaded.

removeDelegateback to summary
public void removeDelegate(ClassLoader cl)
stopback to summary
public void stop()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
com.sun.enterprise.module.impl back to summary

private final Class ClassLoaderProxy.DelegateCleaner

extends Object
implements Runnable
Class Inheritance
  • java.lang.Object
  • com.sun.enterprise.module.impl.ClassLoaderProxy.DelegateCleaner
All Implemented Interfaces
java.lang.Runnable

Field Summary

Modifier and TypeField and Description
private final List<ClassLoaderFacade>
private final List<ClassLoader>

Constructor Summary

AccessConstructor and Description
pack-priv
DelegateCleaner(List<ClassLoader> surrogates, List<ClassLoaderFacade> facadeSurrogates)

Method Summary

Modifier and TypeMethod and Description
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

facadeSurrogatesback to summary
private final List<ClassLoaderFacade> facadeSurrogates
surrogatesback to summary
private final List<ClassLoader> surrogates

Constructor Detail

DelegateCleanerback to summary
pack-priv DelegateCleaner(List<ClassLoader> surrogates, List<ClassLoaderFacade> facadeSurrogates)

Method Detail

runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override