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 Details
-
AbstractGauge
public AbstractGauge()
-
-
Method Details
-
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 theMetricRegistry
- 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 interfaceGuiceLifecycleListener
-