com.espertech.esper.metrics.codahale_metrics.metrics.core
Class Gauge<T>

java.lang.Object
  extended by com.espertech.esper.metrics.codahale_metrics.metrics.core.Gauge<T>
Type Parameters:
T - the type of the metric's value
All Implemented Interfaces:
Metric
Direct Known Subclasses:
JmxGauge, RatioGauge, ToggleGauge

public abstract class Gauge<T>
extends java.lang.Object
implements Metric

A gauge metric is an instantaneous reading of a particular value. To instrument a queue's depth, for example:


 final Queue<String> queue = new ConcurrentLinkedQueue<String>();
 final Gauge<Integer> queueDepth = new Gauge<Integer>() {
     public Integer value() {
         return queue.size();
     }
 };
 


Constructor Summary
Gauge()
           
 
Method Summary
<U> void
processWith(MetricProcessor<U> processor, MetricName name, U context)
          Allow the given MetricProcessor to process this as a metric.
abstract  T value()
          Returns the metric's current value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Gauge

public Gauge()
Method Detail

value

public abstract T value()
Returns the metric's current value.

Returns:
the metric's current value

processWith

public <U> void processWith(MetricProcessor<U> processor,
                            MetricName name,
                            U context)
                 throws java.lang.Exception
Description copied from interface: Metric
Allow the given MetricProcessor to process this as a metric.

Specified by:
processWith in interface Metric
Type Parameters:
U - the type of the context object
Parameters:
processor - a MetricProcessor
name - the name of the current metric
context - a given context which should be passed on to processor
Throws:
java.lang.Exception - if something goes wrong

© 2006-2016 EsperTech Inc.
All rights reserved.
Visit us at espertech.com