|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.apache.commons.javaflow.ContinuationClassLoader
public final class ContinuationClassLoader
URLClassLoader with bytecode instrumentation for javaflow.
This class loader is useful where the application can set up multiple class loaders (such as in a container environment, ClassWorlds, or Forehead) and when you can isolate the continuation-enabled portion of your application into a separate jar file.
| Constructor Summary | |
|---|---|
ContinuationClassLoader(URL[] urls,
ClassLoader parent)
|
|
ContinuationClassLoader(URL[] urls,
ClassLoader parent,
ResourceTransformer transformer)
Creates a classloader by using the classpath given. |
|
| Method Summary | |
|---|---|
void |
addLoaderPackageRoot(String packageRoot)
Adds a package root to the list of packages which must be loaded using this loader. |
void |
addSystemPackageRoot(String packageRoot)
Adds a package root to the list of packages which must be loaded on the parent loader. |
protected Class<?> |
defineClassFromData(byte[] classData,
String classname)
Define a class given its bytes |
Class<?> |
findClass(String name)
Searches for and load a class on the classpath of this class loader. |
Class<?> |
forceLoadClass(String classname)
Loads a class through this class loader even if that class is available on the parent classpath. |
URL |
getResource(String name)
Finds the resource with the given name. |
protected Class<?> |
loadClass(String classname,
boolean resolve)
Loads a class with this class loader. |
void |
setIsolated(boolean isolated)
Sets whether this classloader should run in isolated mode. |
void |
setParentFirst(boolean parentFirst)
Control whether class lookup is delegated to the parent loader first or after this loader. |
| Methods inherited from class java.net.URLClassLoader |
|---|
addURL, definePackage, findResource, findResources, getPermissions, getURLs, newInstance, newInstance |
| Methods inherited from class java.security.SecureClassLoader |
|---|
defineClass, defineClass |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ContinuationClassLoader(URL[] urls,
ClassLoader parent,
ResourceTransformer transformer)
urls - The URLs from which to load classes and resourcesparent - The parent classloader to which unsatisfied loading
attempts are delegated. May be null,
in which case the system classloader
is used as the parent.transformer - This transformer is used to perform the byte-code enhancement.
May not be null.
public ContinuationClassLoader(URL[] urls,
ClassLoader parent)
| Method Detail |
|---|
public void setParentFirst(boolean parentFirst)
parentFirst - if true, delegate initial class search to the parent
classloader.public void setIsolated(boolean isolated)
isolated - Whether or not this classloader should run in
isolated mode.public void addSystemPackageRoot(String packageRoot)
packageRoot - The root of all packages to be included.
Should not be null.public void addLoaderPackageRoot(String packageRoot)
packageRoot - The root of all packages to be included.
Should not be null.
public Class<?> forceLoadClass(String classname)
throws ClassNotFoundException
classname - The name of the class to be loaded.
Must not be null.
ClassNotFoundException - if the requested class does not exist
on this loader's classpath.
protected Class<?> loadClass(String classname,
boolean resolve)
throws ClassNotFoundException
loadClass in class ClassLoaderclassname - The name of the class to be loaded.
Must not be null.resolve - true if all classes upon which this class
depends are to be loaded.
ClassNotFoundException - if the requested class does not exist
on the system classpath (when not in isolated mode) or this loader's
classpath.
protected Class<?> defineClassFromData(byte[] classData,
String classname)
classData - the bytecode data for the classclassname - the name of the class
public Class<?> findClass(String name)
throws ClassNotFoundException
findClass in class URLClassLoadername - The name of the class to be loaded. Must not be
null.
ClassNotFoundException - if the requested class does not exist
on this loader's classpath.public URL getResource(String name)
getResource in class ClassLoadername - The name of the resource for which a stream is required.
Must not be null.
null if the
resource could not be found or the caller doesn't have
adequate privileges to get the resource.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||