Package com.sun.enterprise.loader
Class CurrentBeforeParentClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- java.security.SecureClassLoader
-
- java.net.URLClassLoader
-
- com.sun.enterprise.loader.CurrentBeforeParentClassLoader
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
ASURLClassLoader
public class CurrentBeforeParentClassLoader extends URLClassLoader
As the name suggests, loads classes via current class loader ahead of parent class loader by default, classes are loaded from the parent ClassLoader first, thus this class is needed to allow overriding App Server's Modules / JAR files by placing them into <domain_dir>/lib or EAR lib directory- Author:
- lprimak
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
currentBeforeParentEnabled
static String
PARENT_CLASSLOADER_DELEGATE_PROPERTY
-
Constructor Summary
Constructors Constructor Description CurrentBeforeParentClassLoader(URL[] urls)
CurrentBeforeParentClassLoader(URL[] urls, ClassLoader parent)
CurrentBeforeParentClassLoader(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addURL(URL url)
void
disableCurrentBeforeParent()
disable functionalityvoid
enableCurrentBeforeParent()
enable current-first behavior conditional upon PARENT_CLASSLOADER_DELEGATE_PROPERTY system property being turned onvoid
enableCurrentBeforeParentUnconditional()
enable current-first behavior unconditionally, regardless of system property used by application configuration parser, so if application developer uses the config xml element, they presumably want the behavior regardless of the system property settingsprotected boolean
isWhiteListed(String className)
support for extreme class loadingprotected boolean
isWhitelistEnabled()
protected Class<?>
loadClass(String name, boolean resolve)
Local-first class loading, instead of parent-first as the ClassLoader.loadClass() does-
Methods inherited from class java.net.URLClassLoader
close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
-
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Field Detail
-
currentBeforeParentEnabled
protected boolean currentBeforeParentEnabled
-
PARENT_CLASSLOADER_DELEGATE_PROPERTY
public static final String PARENT_CLASSLOADER_DELEGATE_PROPERTY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CurrentBeforeParentClassLoader
public CurrentBeforeParentClassLoader(URL[] urls, ClassLoader parent)
-
CurrentBeforeParentClassLoader
public CurrentBeforeParentClassLoader(URL[] urls)
-
CurrentBeforeParentClassLoader
public CurrentBeforeParentClassLoader(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory)
-
-
Method Detail
-
loadClass
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
Local-first class loading, instead of parent-first as the ClassLoader.loadClass() does- Overrides:
loadClass
in classClassLoader
- Parameters:
name
-resolve
-- Returns:
- Loaded class
- Throws:
ClassNotFoundException
-
isWhiteListed
protected boolean isWhiteListed(String className)
support for extreme class loading- Parameters:
className
-- Returns:
- true if white-listed
-
isWhitelistEnabled
protected boolean isWhitelistEnabled()
- Returns:
- true if extreme classloading is enabled
-
enableCurrentBeforeParent
public final void enableCurrentBeforeParent()
enable current-first behavior conditional upon PARENT_CLASSLOADER_DELEGATE_PROPERTY system property being turned on
-
enableCurrentBeforeParentUnconditional
public final void enableCurrentBeforeParentUnconditional()
enable current-first behavior unconditionally, regardless of system property used by application configuration parser, so if application developer uses the config xml element, they presumably want the behavior regardless of the system property settings
-
disableCurrentBeforeParent
public final void disableCurrentBeforeParent()
disable functionality
-
addURL
public void addURL(URL url)
- Overrides:
addURL
in classURLClassLoader
-
-