Class ExtensionFinder
- All Implemented Interfaces:
- ExtensionPoint
- Direct Known Subclasses:
- CLIRegisterer,- ExtensionFinder.GuiceFinder,- ExtensionFinder.Sezpoz
 This extension point allows you to write your implementations of ExtensionPoints
 in arbitrary DI containers, and have Hudson discover them.
 
 ExtensionFinder itself is an extension point, but to avoid infinite recursion,
 Jenkins discovers ExtensionFinders through ExtensionFinder.Sezpoz and that alone.
- Since:
- 1.286
- Author:
- Kohsuke Kawaguchi
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classstatic classCaptures information about the annotation that we use to mark Guice-instantiated components.static classDiscovers components via sezpoz but instantiates them by using Guice.static final classThe bootstrap implementation that looks for theExtensionmarker.Nested classes/interfaces inherited from interface hudson.ExtensionPointExtensionPoint.LegacyInstancesAreScopedToHudson
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescription<T> Collection<ExtensionComponent<T>> Deprecated.abstract <T> Collection<ExtensionComponent<T>> Discover extensions of the given type.<T> Collection<T> findExtensions(Class<T> type, Hudson hudson) Deprecated.booleanReturns true if this extension finder supports therefresh()operation.abstract ExtensionComponentSetrefresh()Rebuilds the internal index, if any, so that futurefind(Class, Hudson)calls will discover components newly added toPluginManager.uberClassLoader.voidPerforms class initializations without creating instances.
- 
Constructor Details- 
ExtensionFinderpublic ExtensionFinder()
 
- 
- 
Method Details- 
findExtensions@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Deprecated public <T> Collection<T> findExtensions(Class<T> type, Hudson hudson) Deprecated.as of 1.356 Use and implementfind(Class,Hudson)that allows us to put some metadata.
- 
isRefreshablepublic boolean isRefreshable()Returns true if this extension finder supports therefresh()operation.
- 
refreshRebuilds the internal index, if any, so that futurefind(Class, Hudson)calls will discover components newly added toPluginManager.uberClassLoader.The point of the refresh operation is not to disrupt instances of already loaded ExtensionComponents, and only instantiate those that are new. Otherwise this will break the singleton semantics of various objects, such asDescriptors.The behaviour is undefined if isRefreshable()is returning false.- Returns:
- never null
- Throws:
- ExtensionRefreshException
- Since:
- 1.442
- See Also:
 
- 
findDiscover extensions of the given type.This method is called only once per the given type after all the plugins are loaded, so implementations need not worry about caching. This method should return all the known components at the time of the call, including those that are discovered later via refresh(), even though those components are separately returned inExtensionComponentSet.- Type Parameters:
- T- The type of the extension points. This is not bound to- ExtensionPointbecause of- Descriptor, which by itself doesn't implement- ExtensionPointfor a historical reason.
- Parameters:
- jenkins- Jenkins whose behalf this extension finder is performing lookup.
- Returns:
- Can be empty but never null.
- Since:
- 1.356
      Older implementations provide findExtensions(Class,Hudson)
 
- 
_findDeprecated.
- 
scoutPerforms class initializations without creating instances. If two threads try to initialize classes in the opposite order, a dead lock will ensue, and we can get into a similar situation withExtensionFinders.That is, one thread can try to list extensions, which results in ExtensionFinderloading and initializing classes. This happens inside a context of a lock, so that another thread that tries to list the same extensions don't end up creating different extension instances. So this activity locks extension list first, then class initialization next.In the mean time, another thread can load and initialize a class, and that initialization can eventually results in listing up extensions, for example through static initializer. Such activity locks class initialization first, then locks extension list. This inconsistent locking order results in a dead lock, you see. So to reduce the likelihood, this method is called in prior to find(Class,Hudson)invocation, but from outside the lock. The implementation is expected to perform all the class initialization activities from here.See JDK-4993813 for how to force a class initialization. Also see this blog post for how class initialization can results in a dead lock. 
 
- 
find(Class,Hudson)that allows us to put some metadata.