org.opennms.protocols.jmx.connectors
Class IsolatingClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.opennms.protocols.jmx.connectors.IsolatingClassLoader
public class IsolatingClassLoader
- extends URLClassLoader
An extension of the URLClassLoader that ensures it loads specified
packages rather letting the parent do it. The result is that classes
loaded from these packages are isolated from other classloaders.
- Author:
- Mike Jamison , OpenNMS
|
Method Summary |
protected Class |
loadClass(String name,
boolean resolve)
Override to only check parent ClassLoader if the class name
doesn't match our list of isolated classes. |
| Methods inherited from class java.lang.ClassLoader |
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IsolatingClassLoader
public IsolatingClassLoader(String name,
URL[] classpath,
String[] isolated,
boolean augmentClassPath)
throws IsolatingClassLoader.InvalidContextClassLoaderException
- Parameters:
classpath - Where to find classes.isolated - Array of fully qualified class names, or fully
qualified prefixes ending in "*", that identify the packages or
classes to isolate.augmentClassPath - true => Add the URL's of the current
thread context class loader to classpath.
- Throws:
IsolatingClassLoader.InvalidContextClassLoaderException - If augmentClassPath
is true and the current thread context class loader is not a
URLClassLoader.
IsolatingClassLoader
public IsolatingClassLoader(String name,
URL[] classpath,
ClassLoader parent,
String[] isolated,
boolean augmentClassPath)
throws IsolatingClassLoader.InvalidContextClassLoaderException
- Parameters:
classpath - Where to find classes.isolated - Array of fully qualified class names, or fully
qualified prefixes ending in "*", that identify the packages or
classes to isolate.augmentClassPath - true => Add the URL's of the current
thread context class loader to classpath.
- Throws:
IsolatingClassLoader.InvalidContextClassLoaderException - If augmentClassPath
is true and the current thread context class loader is not a
URLClassLoader.
loadClass
protected Class loadClass(String name,
boolean resolve)
throws ClassNotFoundException
- Override to only check parent ClassLoader if the class name
doesn't match our list of isolated classes.
- Overrides:
loadClass in class ClassLoader
- Throws:
ClassNotFoundException
Copyright © 2009. All Rights Reserved.