public abstract class ExtensionFinder extends Object implements ExtensionPoint
This extension point allows you to write your implementations of
ExtensionPoints in arbitrary DI containers, and have Hudson discover
|Modifier and Type||Class and Description|
The default implementation that looks for the
|Constructor and Description|
|Modifier and Type||Method and Description|
A pointless function to work around what appears to be a HotSpot problem.
Discover extensions of the given type.
as of 1.356 Use and implement
Performs class initializations without creating instances.
@Deprecated public <T> Collection<T> findExtensions(Class<T> type, Hudson hudson)
find(Class, Hudson)that allows us to put some metadata.
public abstract <T> Collection<ExtensionComponent<T>> find(Class<T> type, Hudson hudson)
This method is called only once per the given type after all the plugins are loaded, so implementations need not worry about caching.
T- The type of the extension points. This is not bound to
Descriptor, which by itself doesn't implement
ExtensionPointfor a historical reason.
hudson- Hudson whose behalf this extension finder is performing lookup.
public <T> Collection<ExtensionComponent<T>> _find(Class<T> type, Hudson hudson)
That is, one thread can try to list extensions, which results in
ExtensionFinder loading 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 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6459208 for how to force a class initialization. Also see http://kohsuke.org/2010/09/01/deadlock-that-you-cant-avoid/ for how class initialization can results in a dead lock.
Copyright © 2004-2015 Hudson. All Rights Reserved.