com.netflix.servo.monitor
Class BasicGauge<T extends java.lang.Number>

java.lang.Object
  extended by com.netflix.servo.monitor.AbstractMonitor<T>
      extended by com.netflix.servo.monitor.BasicGauge<T>
All Implemented Interfaces:
Gauge<T>, Monitor<T>, NumericMonitor<T>

public final class BasicGauge<T extends java.lang.Number>
extends AbstractMonitor<T>
implements Gauge<T>

A gauge implementation that invokes a specified callable to get the current value.


Field Summary
 
Fields inherited from class com.netflix.servo.monitor.AbstractMonitor
config
 
Constructor Summary
BasicGauge(MonitorConfig config, java.util.concurrent.Callable<T> function)
          Creates a new instance of the gauge.
 
Method Summary
 boolean equals(java.lang.Object obj)
          
 T getValue()
          Returns the current value for the monitor.
 int hashCode()
          
 java.lang.String toString()
          
 
Methods inherited from class com.netflix.servo.monitor.AbstractMonitor
getConfig
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.netflix.servo.monitor.Monitor
getConfig
 

Constructor Detail

BasicGauge

public BasicGauge(MonitorConfig config,
                  java.util.concurrent.Callable<T> function)
Creates a new instance of the gauge.

Parameters:
config - configuration for this monitor
function - a function used to fetch the value on demand
Method Detail

getValue

public T getValue()
Returns the current value for the monitor.

Specified by:
getValue in interface Monitor<T extends java.lang.Number>

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object