类 ExtensionLoader<T>


  • public class ExtensionLoader<T>
    extends Object
    ApplicationModel, DubboBootstrap and this class are at present designed to be singleton or static (by itself totally static or uses some static fields). So the instances returned from them are of process or classloader scope. If you want to support multiple dubbo servers in a single process, you may need to refactor these three classes.

    Load dubbo extensions

    • auto inject dependency extension
    • auto wrap extension in wrapper
    • default extension is an adaptive instance
    另请参阅:
    Service Provider in Java 5, SPI, Adaptive, Activate
    • 方法详细资料

      • setLoadingStrategies

        public static void setLoadingStrategies​(LoadingStrategy... strategies)
      • resetExtensionLoader

        @Deprecated
        public static void resetExtensionLoader​(Class type)
        已过时。
      • destroyAll

        @Deprecated
        public static void destroyAll()
        已过时。
      • getExtensionName

        public String getExtensionName​(T extensionInstance)
      • getExtensionName

        public String getExtensionName​(Class<?> extensionClass)
      • getActivateExtension

        public List<T> getActivateExtension​(URL url,
                                            String[] values,
                                            String group)
        Get activate extensions.
        参数:
        url - url
        values - extension point names
        group - group
        返回:
        extension list which are activated
        另请参阅:
        Activate
      • getLoadedExtension

        public T getLoadedExtension​(String name)
        Get extension's instance. Return null if extension is not found or is not initialized. Pls. note that this method will not trigger extension load.

        In order to trigger extension load, call getExtension(String) instead.

        另请参阅:
        getExtension(String)
      • getLoadedExtensionInstances

        public List<T> getLoadedExtensionInstances()
      • getLoadedAdaptiveExtensionInstances

        public Object getLoadedAdaptiveExtensionInstances()
      • getExtension

        public T getExtension​(String name)
        Find the extension with the given name. If the specified name is not found, then IllegalStateException will be thrown.
      • getExtension

        public T getExtension​(String name,
                              boolean wrap)
      • getOrDefaultExtension

        public T getOrDefaultExtension​(String name)
        Get the extension by specified name if found, or returns the default one
        参数:
        name - the name of extension
        返回:
        non-null
      • getDefaultExtension

        public T getDefaultExtension()
        Return default extension, return null if it's not configured.
      • hasExtension

        public boolean hasExtension​(String name)
      • getSupportedExtensions

        public Set<String> getSupportedExtensions()
      • getSupportedExtensionInstances

        public Set<T> getSupportedExtensionInstances()
      • getDefaultExtensionName

        public String getDefaultExtensionName()
        Return default extension name, return null if not configured.
      • addExtension

        public void addExtension​(String name,
                                 Class<?> clazz)
        Register new extension via API
        参数:
        name - extension name
        clazz - extension class
        抛出:
        IllegalStateException - when extension with the same name has already been registered.
      • replaceExtension

        @Deprecated
        public void replaceExtension​(String name,
                                     Class<?> clazz)
        已过时。
        not recommended any longer, and use only when test
        Replace the existing extension via API
        参数:
        name - extension name
        clazz - extension class
        抛出:
        IllegalStateException - when extension to be placed doesn't exist
      • getAdaptiveExtension

        public T getAdaptiveExtension()