The Composite class loader also has registered the classloader that loaded xstream.jar and (if available) the thread's context classloader.
CompositeClassLoader loader = new CompositeClassLoader(); loader.add(MyClass.class.getClassLoader()); loader.add(new AnotherClassLoader()); loader.loadClass("com.blah.ChickenPlucker");
The above code will attempt to load a class from the following classloaders (in order):
The added classloaders are kept with weak references to allow an application container to reload classes.
@author Joe Walnes @author Jörg Schaible @since 1.0.3When resolving classes, the parent classloader is consulted first, and if that classloader cannot find the class, the alternate/second classloader is asked to resolve the class. @author Lucian Chirita (lucianc@users.sourceforge.net) @version $Id: CompositeClassloader.java 3034 2009-08-27 11:58:04Z teodord $
|
|
|
|
|
|
|
|