Class CrowdOsgiContainerManager

java.lang.Object
com.atlassian.plugin.osgi.container.felix.FelixOsgiContainerManager
com.atlassian.crowd.plugin.CrowdOsgiContainerManager
All Implemented Interfaces:
com.atlassian.plugin.osgi.container.OsgiContainerManager

public class CrowdOsgiContainerManager extends com.atlassian.plugin.osgi.container.felix.FelixOsgiContainerManager
OSGI container manager that caches service trackers. This is necessary to avoid creating ServiceTracker instances willy nilly, while at the same time circumventing a memory leak in FelixOsgiContainerManager (JRA-18766).
  • Field Summary

    Fields inherited from class com.atlassian.plugin.osgi.container.felix.FelixOsgiContainerManager

    ATLASSIAN_BOOTDELEGATION, ATLASSIAN_BOOTDELEGATION_EXTRA, ATLASSIAN_DISABLE_REFERENCE_PROTOCOL, REFRESH_TIMEOUT
  • Constructor Summary

    Constructors
    Constructor
    Description
    CrowdOsgiContainerManager(com.atlassian.plugin.osgi.container.OsgiPersistentCache persistentCache, com.atlassian.plugin.osgi.container.PackageScannerConfiguration packageScannerConfig, com.atlassian.plugin.osgi.hostcomponents.HostComponentProvider provider, com.atlassian.plugin.event.PluginEventManager eventManager, com.atlassian.plugin.servlet.ServletContextFactory servletContextFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    Retrieves and returns a public component from OSGi land via its class or interface name.
    <T> List<T>
    Retrieves and returns all public components from OSGi land via its class or interface name.
    void
     

    Methods inherited from class com.atlassian.plugin.osgi.container.felix.FelixOsgiContainerManager

    addBundleListener, clearExportCache, getBundles, getHostComponentRegistrations, getRegisteredServices, getServiceTracker, getServiceTracker, installBundle, isRunning, onPluginFrameworkWarmRestarting, onPluginUninstallation, onPluginUpgrade, onShutdown, onStart, removeBundleListener, setDisableMultipleBundleVersions, setFelixLogger, start

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CrowdOsgiContainerManager

      public CrowdOsgiContainerManager(com.atlassian.plugin.osgi.container.OsgiPersistentCache persistentCache, com.atlassian.plugin.osgi.container.PackageScannerConfiguration packageScannerConfig, com.atlassian.plugin.osgi.hostcomponents.HostComponentProvider provider, com.atlassian.plugin.event.PluginEventManager eventManager, com.atlassian.plugin.servlet.ServletContextFactory servletContextFactory)
  • Method Details

    • getOsgiComponentOfType

      public <T> T getOsgiComponentOfType(Class<T> clazz)
      Retrieves and returns a public component from OSGi land via its class or interface name. This method can be used to retrieve a component provided via a plugins2 OSGi bundle. Please note that components returned via this method should NEVER be cached (e.g. in a field) as they may be refreshed at any time as a plugin is enabled/disabled or the ComponentManager is reinitialised (after an XML import).

      Added as part of the fix for JRADEV-6195.

      Parameters:
      clazz - The interface class as a String
      Returns:
      the component, or null if not found
    • getOsgiComponentsOfType

      @Nonnull public <T> List<T> getOsgiComponentsOfType(Class<T> clazz)
      Retrieves and returns all public components from OSGi land via its class or interface name. This method can be used to retrieve a component provided via a plugins2 OSGi bundle. Please note that components returned via this method should NEVER be cached (e.g. in a field) as they may be refreshed at any time as a plugin is enabled/disabled or the ComponentManager is reinitialised (after an XML import).
      Parameters:
      clazz - The interface class as a String
      Returns:
      the component, or null if not found
    • stop

      public void stop() throws com.atlassian.plugin.osgi.container.OsgiContainerException
      Specified by:
      stop in interface com.atlassian.plugin.osgi.container.OsgiContainerManager
      Overrides:
      stop in class com.atlassian.plugin.osgi.container.felix.FelixOsgiContainerManager
      Throws:
      com.atlassian.plugin.osgi.container.OsgiContainerException