public class SystemClassLoader extends ClassLoader
You will need the following jars in your classpath (log4j.jar is optional):
java -Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader my.MainImplementation Detail: All access to non-jre classes must be done through reflection the classes must be loaded using the loadLocally method.
Constructor and Description |
---|
SystemClassLoader(ClassLoader parent)
Construct a new system classloader.
|
Modifier and Type | Method and Description |
---|---|
protected Class<?> |
defineClassFromBytes(String name,
org.jboss.aop.standalone.SystemClassLoader.ClassBytes bytes,
boolean resolve)
Define a class from the bytes
|
protected void |
definePackage(String className)
Define the package for the class if not already done
|
protected void |
initialize()
Initialize the aspect manager and load the static aspects
|
protected void |
install()
Install the classloader, get reflection objects and load
classes using ourself.
|
Class<?> |
loadClass(String name,
boolean resolve)
Load a class, overridden to transform aop enhanced classes
and load non jre classes through this classloader.
|
protected Class<?> |
loadClassByDelegation(String name)
Load jre classes from the parent classloader
|
protected org.jboss.aop.standalone.SystemClassLoader.ClassBytes |
loadClassBytes(String name)
Load the bytecode for a class
|
protected Class<?> |
loadClassLocally(String name)
Load a class using this classloader only
|
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public SystemClassLoader(ClassLoader parent)
We cannot do much here, we need to avoid recursion
parent
- the default system classloaderpublic Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
loadClass
in class ClassLoader
name
- the class nameresolve
- whether to resolve the classClassNotFoundException
- when there is no classprotected org.jboss.aop.standalone.SystemClassLoader.ClassBytes loadClassBytes(String name) throws ClassNotFoundException, IOException
ClassNotFoundException
IOException
protected Class<?> defineClassFromBytes(String name, org.jboss.aop.standalone.SystemClassLoader.ClassBytes bytes, boolean resolve)
b
- the bytecoderesolve
- whether to resolve the classprotected void definePackage(String className)
name
- the class nameprotected Class<?> loadClassLocally(String name) throws ClassNotFoundException
name
- the class nameClassNotFoundException
- when there is no classprotected Class<?> loadClassByDelegation(String name) throws ClassNotFoundException
name
- the class nameClassNotFoundException
- when there is no classprotected void install()
protected void initialize()
Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.