Class AbstractIpdMeter

java.lang.Object
com.atlassian.diagnostics.ipd.api.meters.AbstractIpdMeter
All Implemented Interfaces:
IpdMeter
Direct Known Subclasses:
CustomMeterImpl, IpdMeter.NoopMeter

public abstract class AbstractIpdMeter extends Object implements IpdMeter
Base class for all IPD meters. Shares common method implementations.
  • Constructor Details

    • AbstractIpdMeter

      protected AbstractIpdMeter(MeterConfig meterConfig)
  • Method Details

    • getConfig

      public MeterConfig getConfig()
      Description copied from interface: IpdMeter
      Meter configuration is constructed when meter is created for the first time and is immutable.
      Specified by:
      getConfig in interface IpdMeter
      Returns:
      Read-only meter configuration for this meter
    • getMeterKey

      public MeterKey getMeterKey()
      Specified by:
      getMeterKey in interface IpdMeter
      Returns:
      MeterKey that identifies meter by name and tag values
    • getObjectName

      public ObjectName getObjectName()
      Description copied from interface: IpdMeter
      ObjectName of the MBean. Can be used to query this metric value in JMX.
      Specified by:
      getObjectName in interface IpdMeter
      Returns:
      ObjectName of this metric
    • isEnabled

      public boolean isEnabled()
      Specified by:
      isEnabled in interface IpdMeter
      Returns:
      false if the meter is closed IpdMeter.close() or MeterConfig.getEnabledCheck() check returns false, true otherwise
    • hideUntilUpdate

      public void hideUntilUpdate()
      Description copied from interface: IpdMeter
      Hides the meter in JMX until the next value update. IpdMeter.isVisible() will return false until the next value update.
      Specified by:
      hideUntilUpdate in interface IpdMeter
    • lastUpdateMillis

      public long lastUpdateMillis()
      Description copied from interface: IpdMeter
      Returns the timestamp of the last value update in milliseconds. See Clock.millis().
      Specified by:
      lastUpdateMillis in interface IpdMeter
      Returns:
      timestamp of the last value update in milliseconds
    • metricUpdated

      protected void metricUpdated()
    • registerMBean

      protected abstract void registerMBean()
      Registers the MBean in the MBeanServer.
      Method will be called when the meter is enabled and is visible in JMX.
    • unregisterMBean

      protected abstract void unregisterMBean()
      Unregisters the MBean from the MBeanServer.
      Method will be called when the meter is closed or is hidden from JMX.
    • close

      public void close()
      Description copied from interface: IpdMeter
      Permanently closes this instance of the meter. This instance will always return false for IpdMeter.isEnabled() and IpdMeter.isVisible().
      This method is called on meter instances that are removed from the IpdRegistry
      Specified by:
      close in interface IpdMeter
    • isClosed

      public boolean isClosed()
      Description copied from interface: IpdMeter
      Checks if the meter is closed. A closed meter can't be enabled or visible in JMX. It's a terminal state that is triggered when a meter is removed from the IpdRegistry. You can get a new instance of the meter from the IpdRegistry.
      Specified by:
      isClosed in interface IpdMeter
      Returns:
      true if the meter is closed, false otherwise