org.red5.classloading
Class ChildFirstClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.red5.classloading.ChildFirstClassLoader
public final class ChildFirstClassLoader
- extends URLClassLoader
An almost trivial no-fuss implementation of a class loader following the
child-first delegation model.
Based on code from Ceki Gulcu
- Author:
- Paul Gregoire ([email protected])
Method Summary |
URL |
getResource(String name)
Override the parent-first resource loading model established by
java.lang.Classloader with child-first behavior. |
Class<?> |
loadClass(String name)
|
protected Class<?> |
loadClass(String name,
boolean resolve)
We override the parent-first behavior established by
java.lang.Classloader. |
Methods inherited from class java.lang.ClassLoader |
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ChildFirstClassLoader
public ChildFirstClassLoader(URL[] urls)
ChildFirstClassLoader
public ChildFirstClassLoader(URL[] urls,
ClassLoader parent)
loadClass
public Class<?> loadClass(String name)
throws ClassNotFoundException
- Overrides:
loadClass
in class ClassLoader
- Throws:
ClassNotFoundException
loadClass
protected Class<?> loadClass(String name,
boolean resolve)
throws ClassNotFoundException
- We override the parent-first behavior established by
java.lang.Classloader.
The implementation is surprisingly straightforward.
- Overrides:
loadClass
in class ClassLoader
- Parameters:
name
- the name of the class to load, should not be null
.resolve
- flag that indicates whether the class should be resolved.
- Returns:
- the loaded class, never
null
.
- Throws:
ClassNotFoundException
- if the class could not be loaded.
getResource
public URL getResource(String name)
- Override the parent-first resource loading model established by
java.lang.Classloader with child-first behavior.
- Overrides:
getResource
in class ClassLoader
- Parameters:
name
- the name of the resource to load, should not be
null
.
- Returns:
- a
URL
for the resource, or null
if it could
not be found.
Copyright © 2006-2012 The Red5 Project