[JENKINS-38867] Optimize performance of Actionable.getAllActions (#2582)
* Optimize Actionable.getAllActions. * Also need to invalidate the cache when new plugins are installed. * Various improvements to TransientActionFactory caching. · Move the cache code to TransientActionFactory itself, for better encapsulation. · Optimize getAction(Class) to not need to call getAllActions; avoids copying lists, and can avoid calling TransientActionFactory at all. · Ensure that we maintain a separate cache per ExtensionList instance, so that static state is not leaked across Jenkins restarts. * Updated TransientActionFactory to specify what kinds of actions it could produce. * It turns out that changing type parameters for an extension, while generally binary-compatible, breaks reflective code in Jenkins and so this is not an option. … hudson.ExtensionFinder$GuiceFinder$SezpozModule configure WARNING: Failed to load com.cloudbees.hudson.plugins.folder.relocate.RelocationAction$TransientActionFactoryImpl java.lang.LinkageError: Failed to resolve class com.cloudbees.hudson.plugins.folder.relocate.RelocationAction$TransientActionFactoryImpl at hudson.ExtensionFinder$GuiceFinder$SezpozModule.resolve(ExtensionFinder.java:489) at hudson.ExtensionFinder$GuiceFinder$SezpozModule.configure(ExtensionFinder.java:506) at … at hudson.ExtensionFinder$GuiceFinder.<init>(ExtensionFinder.java:280) at … at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:472) at hudson.ExtensionList.load(ExtensionList.java:349) at hudson.ExtensionList.ensureLoaded(ExtensionList.java:287) at hudson.ExtensionList.getComponents(ExtensionList.java:167) at jenkins.model.Jenkins$8.onInitMilestoneAttained(Jenkins.java:1082) at jenkins.InitReactorRunner$1.onAttained(InitReactorRunner.java:82) at org.jvnet.hudson.reactor.ReactorListener$Aggregator.onAttained(ReactorListener.java:104) at org.jvnet.hudson.reactor.Reactor$1.run(Reactor.java:176) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.reflect.MalformedParameterizedTypeException at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(ParameterizedTypeImpl.java:58) at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.<init>(ParameterizedTypeImpl.java:51) at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(ParameterizedTypeImpl.java:92) at sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(CoreReflectionFactory.java:105) at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:140) at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) at sun.reflect.generics.repository.ClassRepository.getSuperclass(ClassRepository.java:90) at java.lang.Class.getGenericSuperclass(Class.java:777) at hudson.ExtensionFinder$GuiceFinder$SezpozModule.resolve(ExtensionFinder.java:470) ... 29 more * Remove actionType override to make for a simpler diff. * Strengthened test to cover accesses to unrelated context types. * Strengthening tests in a couple of ways. * Javadoc improvements suggested by @oleg-nenashev.
Loading
Please register or sign in to comment