Package hudson
Class PluginManager.UberClassLoader
java.lang.Object
java.lang.ClassLoader
hudson.util.DelegatingClassLoader
hudson.util.CachingClassLoader
hudson.PluginManager.UberClassLoader
- Enclosing class:
PluginManager
ClassLoader
that can see all plugins.-
Constructor Summary
ConstructorsConstructorDescriptionUberClassLoader
(List<PluginWrapper> activePlugins) The servlet container'sClassLoader
(the parent of Jenkins core) is parallel-capable and maintains its own growingMap
ofClassLoader.getClassLoadingLock(java.lang.String)
objects per class name for every load attempt (including misses), and we cannot override this behavior. -
Method Summary
Modifier and TypeMethodDescriptionprotected Class
<?> protected URL
findResource
(String name) protected Enumeration
<URL> findResources
(String name) boolean
isPluginJar
(URL jarUrl) protected Class
<?> Parent-first delegation without synchronizing onClassLoader.getClassLoadingLock(String)
.toString()
Methods inherited from class hudson.util.CachingClassLoader
clearCacheMisses
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, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Constructor Details
-
UberClassLoader
The servlet container'sClassLoader
(the parent of Jenkins core) is parallel-capable and maintains its own growingMap
ofClassLoader.getClassLoadingLock(java.lang.String)
objects per class name for every load attempt (including misses), and we cannot override this behavior. Wrap the servlet containerClassLoader
inExistenceCheckingClassLoader
to avoid callingClassLoader.getParent()
'sClassLoader.loadClass(String, boolean)
at all for misses by first checking if the resource exists. If the resource does not exist, we immediately throwClassNotFoundException
. As a result, the servlet container'sClassLoader
is never asked to try and fail, and it never creates/retains lock objects for those misses.
-
-
Method Details
-
loadClass
Description copied from class:DelegatingClassLoader
Parent-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:
loadClass
in classCachingClassLoader
- Parameters:
name
- The binary name of the classresolve
- Iftrue
then resolve the class- Returns:
- The resulting
Class
object - Throws:
ClassNotFoundException
- If the class could not be found
-
findClass
- Overrides:
findClass
in classClassLoader
- Throws:
ClassNotFoundException
-
findResource
- Overrides:
findResource
in classClassLoader
-
findResources
- Overrides:
findResources
in classClassLoader
- Throws:
IOException
-
toString
-
isPluginJar
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isPluginJar(URL jarUrl)
-