Note
The loaders will always be called in the REVERSE order they were added in.
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.
| Modifier and Type | Field and Description |
|---|---|
| private final List | |
| private final ReferenceQueue |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | |
| private void | |
| private void | |
| public Class | loadClass(String
The binary name of the class name)Overrides java. |
| classLoaders | back to summary |
|---|---|
| private final List<E> classLoaders | |
| queue | back to summary |
|---|---|
| private final ReferenceQueue<T> queue | |
| CompositeClassLoader | back to summary |
|---|---|
| public CompositeClassLoader() | |
| add | back to summary |
|---|---|
| public synchronized void add(ClassLoader classLoader) Add a loader to the n | |
| addInternal | back to summary |
|---|---|
| private void addInternal(ClassLoader classLoader) | |
| cleanup | back to summary |
|---|---|
| private void cleanup() | |
| loadClass | back to summary |
|---|---|
| public Class Overrides java. Doc from java. Loads the class with the specified binary name.
This method searches for classes in the same manner as the
| |