Interface PluginIpdFactory


public interface PluginIpdFactory
This interface should be imported by a plugin that wants to expose metrics via IPD library. This interface creates plugin-specific instance of IpdRegistry. Plugin meters are stored in global product IpdRegistry, enforcing meters to be unique across products and plugins.

Important Note - meters lifecycle:
To avoid meters inconsistency due to plugin reloads and upgrades, the plugin should always cleanup its meters. For safe cleanup of meters, the plugin has to either:
- Register created instance of IpdRegistry as a Bean in Spring context and let Spring manage its lifecycle.
- Manually call IpdRegistry.shutdown() method when the plugin is being shutdown.

Since:
5.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    createJobRegistry(org.osgi.framework.BundleContext bundleContext)
    Creates a new instance of IpdJobRegistry specific for the plugin.
    createRegistry(MeterConfigurations meterConfig, org.osgi.framework.BundleContext bundleContext)
    Creates a new instance of IpdRegistry specific for the plugin.
    createRegistry(org.osgi.framework.BundleContext bundleContext)
    Creates a new instance of IpdRegistry specific for the plugin.
  • Method Details

    • createRegistry

      IpdRegistry createRegistry(org.osgi.framework.BundleContext bundleContext)
      Creates a new instance of IpdRegistry specific for the plugin.

      All meters created with this instance will apply configurations defined in the product.

      Important Note - meters lifecycle:
      To avoid meters inconsistency due to plugin reloads and upgrades, the plugin should always cleanup its meters. For safe cleanup of meters, the plugin has to either:
      - Register created instance of IpdRegistry as a Bean in Spring context and let Spring manage its lifecycle.
      - Manually call IpdRegistry.shutdown() method when the plugin is being shutdown.

      Parameters:
      bundleContext - the bundle context of the plugin
      Returns:
      a new instance of IpdRegistry
    • createRegistry

      IpdRegistry createRegistry(MeterConfigurations meterConfig, org.osgi.framework.BundleContext bundleContext)
      Creates a new instance of IpdRegistry specific for the plugin.

      All meters created with this instance will:
      1. apply configurations defined in the product
      2. override product configurations with plugin-specific configurations provided in the `meterConfig` parameter.

      Important Note - meters lifecycle:
      To avoid meters inconsistency due to plugin reloads and upgrades, the plugin should always cleanup its meters. For safe cleanup of meters, the plugin has to either:
      - Register created instance of IpdRegistry as a Bean in Spring context and let Spring manage its lifecycle.
      - Manually call IpdRegistry.shutdown() method when the plugin is being shutdown.

      Parameters:
      bundleContext - the bundle context of the plugin
      Returns:
      a new instance of IpdRegistry
    • createJobRegistry

      IpdJobRegistry createJobRegistry(org.osgi.framework.BundleContext bundleContext)
      Creates a new instance of IpdJobRegistry specific for the plugin.

      All jobs registered with this instance will run in regular interval until the plugin is disabled/uninstalled.

      Important Note - jobs lifecycle:
      To avoid inconsistency due to plugin reloads and upgrades, the plugin should always cleanup its jobs. For safe cleanup of jobs, the plugin has to either:
      - Register created instance of IpdJobsRegistry as a Bean in Spring context and let Spring manage its lifecycle.
      - Manually call IpdJobRegistry.shutdown() method when the plugin is being shutdown.

      Parameters:
      bundleContext - the bundle context of the plugin
      Returns:
      a new instance of IpdJobRegistry