Package hudson.util
Class CachingClassLoader
java.lang.Object
java.lang.ClassLoader
hudson.util.DelegatingClassLoader
hudson.util.CachingClassLoader
- Direct Known Subclasses:
PluginManager.UberClassLoader
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public class CachingClassLoader
extends DelegatingClassLoader
ClassLoader with internal caching of class loading results.
Caches both successful and failed class lookups to avoid redundant delegation and repeated class resolution attempts. Designed for performance optimization in systems that repeatedly query class presence (e.g., plugin environments, reflective loading, optional dependencies).
Useful for classloaders that have heavy-weight loadClass() implementations- Author:
- Dmytro Ukhlov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected Class<?> Parent-first delegation without synchronizing onClassLoader.getClassLoadingLock(String).Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Constructor Details
-
CachingClassLoader
-
-
Method Details
-
loadClass
Description copied from class:DelegatingClassLoaderParent-first delegation without synchronizing onClassLoader.getClassLoadingLock(String). This prevents creation/retention of per-name lock objects in a loader that does not define classes. The defining loader downstream still serializes class definition as required.- Overrides:
loadClassin classDelegatingClassLoader- Parameters:
name- The binary name of the classresolve- Iftruethen resolve the class- Returns:
- The resulting
Classobject - Throws:
ClassNotFoundException- If the class could not be found
-
clearCacheMisses
public void clearCacheMisses()
-