Class AbstractGauge

java.lang.Object
com.peterphi.std.guice.metrics.gauge.AbstractGauge
All Implemented Interfaces:
com.codahale.metrics.Gauge<Long>, com.codahale.metrics.Metric, GuiceLifecycleListener

public abstract class AbstractGauge extends Object implements com.codahale.metrics.Gauge<Long>, GuiceLifecycleListener
Abstract parent class for Gauges. Should be bound as an eager singleton. When created the gauge will be auto-registered with Guice (this behaviour can be customised by implementing logic in enabled(). If enabled returns false then the Gauge will not be registered with guice)
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    Called once at startup after guice has finished building the object.
    abstract String
     
    void
    Called after this object has been fully and successfully constructed

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.codahale.metrics.Gauge

    getValue
  • Constructor Details

    • AbstractGauge

      public AbstractGauge()
  • Method Details

    • getName

      public abstract String getName()
    • enabled

      protected boolean enabled()
      Called once at startup after guice has finished building the object. If this method returns false then the object will not be registered with the MetricRegistry
      Returns:
      true by default if not overridden
    • postConstruct

      public void postConstruct()
      Description copied from interface: GuiceLifecycleListener
      Called after this object has been fully and successfully constructed
      Specified by:
      postConstruct in interface GuiceLifecycleListener