public class BlockingClassLoader extends URLClassLoader
Constructor and Description |
---|
BlockingClassLoader(List<URL> additionalClassPath,
Set<String> blocked,
Set<String> isolated,
Set<String> shared,
boolean respectGrandparents)
Simplified constructor that uses standard application classloader as
the parent.
|
BlockingClassLoader(Set<String> blocked,
Set<String> isolated,
Set<String> shared,
boolean respectGrandparents)
Simplified constructor without
additionalClassPath . |
BlockingClassLoader(URLClassLoader parent,
List<URL> additionalClassPath,
Set<String> blocked,
Set<String> isolated,
Set<String> shared,
boolean respectGrandparents)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
URL |
getResource(String name)
Override only to check parent ClassLoader if not blocked.
|
Enumeration<URL> |
getResources(String name)
Override only to check parent ClassLoader if not blocked.
|
protected Class<?> |
loadClass(String name,
boolean resolve)
Override only to check parent ClassLoader if not blocked.
|
addURL, close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
defineClass, defineClass
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public BlockingClassLoader(URLClassLoader parent, List<URL> additionalClassPath, Set<String> blocked, Set<String> isolated, Set<String> shared, boolean respectGrandparents)
The behaviour is determined by three sets of class names. Each set contains fully qualified class names, or fully qualified prefixes ending in "*", that identify the classes beginning with the package prefix.
Resource names may also be specified, fully qualified with '/' separators as necessary. Wild card package names also filter resources; the '.' separators are translated internally to '/'s.
If multiple sets refer to the same class, shared
has priority
over blocked
, and both have priority over isolated
,
whether or not the class is specified explicitly or using a package prefix.
parent
- Parent classloader.additionalClassPath
- Prepended to the parent's URLs to calculate the classpath for this
class loader.blocked
- Classes to block, whether or not the parent class loader has its
own copies.isolated
- Classes to load in this class loader, whether or not the parent
class loader has its own copies.shared
- Classes that should be loaded by the parent class loader,
overriding blocked
and isolated
.respectGrandparents
- Only block or isolate classes from the parent class loader.public BlockingClassLoader(List<URL> additionalClassPath, Set<String> blocked, Set<String> isolated, Set<String> shared, boolean respectGrandparents)
additionalClassPath
- Prepended to the parent's URLs to calculate the classpath for this
class loader.blocked
- Classes to block, whether or not the parent class loader has its
own copies.isolated
- Classes to load in this class loader, whether or not the parent
class loader has its own copies.shared
- Classes that should be loaded by the parent class loader,
overriding blocked
and isolated
.respectGrandparents
- Only block or isolate classes from the parent class loader.public BlockingClassLoader(Set<String> blocked, Set<String> isolated, Set<String> shared, boolean respectGrandparents)
additionalClassPath
.blocked
- Classes to block, whether or not the parent class loader has its
own copies.isolated
- Classes to load in this class loader, whether or not the parent
class loader has its own copies.shared
- Classes that should be loaded by the parent class loader,
overriding blocked
and isolated
.respectGrandparents
- Only block or isolate classes from the parent class loader.protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
loadClass
in class ClassLoader
ClassNotFoundException
public URL getResource(String name)
getResource
in class ClassLoader
public Enumeration<URL> getResources(String name) throws IOException
getResources
in class ClassLoader
IOException
Copyright © 2000-2014. All Rights Reserved.