@UsesJava7 class ContextTypeMatchClassLoader extends DecoratingClassLoader implements SmartClassLoader
AbstractApplicationContext
. Redefines classes from
a cached byte array for every loadClass
call in order to
pick up recently loaded types in the parent ClassLoader.AbstractApplicationContext
,
ConfigurableBeanFactory.setTempClassLoader(java.lang.ClassLoader)
Modifier and Type | Class and Description |
---|---|
private class |
ContextTypeMatchClassLoader.ContextOverridingClassLoader
ClassLoader to be created for each loaded class.
|
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,byte[]> |
bytesCache
Cache for byte array per class name
|
private static java.lang.reflect.Method |
findLoadedClassMethod |
parallelCapableClassLoaderAvailable
Constructor and Description |
---|
ContextTypeMatchClassLoader(java.lang.ClassLoader parent) |
Modifier and Type | Method and Description |
---|---|
boolean |
isClassReloadable(java.lang.Class<?> clazz)
Determine whether the given class is reloadable (in this ClassLoader).
|
java.lang.Class<?> |
loadClass(java.lang.String name) |
excludeClass, excludePackage, isExcluded
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
private static java.lang.reflect.Method findLoadedClassMethod
private final java.util.Map<java.lang.String,byte[]> bytesCache
public ContextTypeMatchClassLoader(java.lang.ClassLoader parent)
public java.lang.Class<?> loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
loadClass
in class java.lang.ClassLoader
java.lang.ClassNotFoundException
public boolean isClassReloadable(java.lang.Class<?> clazz)
SmartClassLoader
Typically used to check whether the result may be cached (for this ClassLoader) or whether it should be reobtained every time.
isClassReloadable
in interface SmartClassLoader
clazz
- the class to check (usually loaded from this ClassLoader)Class
object) later on