Class CachingWebAppClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.eclipse.jetty.ee.webapp.WebAppClassLoader
org.eclipse.jetty.ee.webapp.CachingWebAppClassLoader
- All Implemented Interfaces:
Closeable, AutoCloseable, org.eclipse.jetty.util.ClassVisibilityChecker
A WebAppClassLoader that caches found and not-found getResource(String) results.
Specifically this ClassLoader caches not-found classes and resources, and found resources
(found classes are already cached by URLClassLoader), which can greatly increase
performance for applications that search for resources.
-
Nested Class Summary
Nested classes/interfaces inherited from class WebAppClassLoader
WebAppClassLoader.Context -
Constructor Summary
ConstructorsConstructorDescriptionCachingWebAppClassLoader(ClassLoader parent, WebAppClassLoader.Context context) CachingWebAppClassLoader(ClassLoader parent, WebAppClassLoader.Context context, int maxEntries) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclose()getResource(String name) Get a resource from the classloadergetResources(String name) protected Class<?> toString()Methods inherited from class WebAppClassLoader
addClassPath, addClassPath, addJars, addTransformer, findClass, foundClass, getContext, getName, getPermissions, isHiddenClass, isProtectedClass, loadAsResource, removeTransformer, runWithHiddenClassAccess, setNameMethods inherited from class URLClassLoader
addURL, definePackage, findResource, findResources, getResourceAsStream, getURLs, newInstance, newInstanceMethods inherited from class SecureClassLoader
defineClass, defineClassMethods inherited from class ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getPackage, getPackages, getParent, getPlatformClassLoader, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSignersMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.ClassVisibilityChecker
isServerClass, isSystemClass
-
Constructor Details
-
CachingWebAppClassLoader
- Throws:
IOException
-
CachingWebAppClassLoader
public CachingWebAppClassLoader(ClassLoader parent, WebAppClassLoader.Context context) throws IOException - Throws:
IOException
-
CachingWebAppClassLoader
public CachingWebAppClassLoader(ClassLoader parent, WebAppClassLoader.Context context, int maxEntries) throws IOException - Throws:
IOException
-
-
Method Details
-
getResources
- Overrides:
getResourcesin classWebAppClassLoader- Throws:
IOException
-
getResource
Description copied from class:WebAppClassLoaderGet a resource from the classloaderNOTE: this method provides a convenience of hacking off a leading / should one be present. This is non-standard and it is recommended to not rely on this behavior
- Overrides:
getResourcein classWebAppClassLoader
-
loadClass
- Overrides:
loadClassin classWebAppClassLoader- Throws:
ClassNotFoundException
-
clearCache
@ManagedOperation public void clearCache() -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classWebAppClassLoader- Throws:
IOException
-
toString
- Overrides:
toStringin classWebAppClassLoader
-