org.apache.hadoop.metrics.util
Class MetricsIntValue

java.lang.Object
  extended by org.apache.hadoop.metrics.util.MetricsIntValue

public class MetricsIntValue
extends Object

The MetricsIntValue class is for a metric that is not time varied but changes only when it is set. Each time its value is set, it is published only *once* at the next update call.


Constructor Summary
MetricsIntValue(String nam)
          Constructor - create a new metric
 
Method Summary
 void dec()
          Dec metrics by one
 void dec(int decr)
          Inc metrics for incr vlaue
 int get()
          Get value
 void inc()
          Inc metrics by one
 void inc(int incr)
          Inc metrics for incr vlaue
 void pushMetric(MetricsRecord mr)
          Push the metric to the mr.
 void set(int newValue)
          Set the value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetricsIntValue

public MetricsIntValue(String nam)
Constructor - create a new metric

Parameters:
nam - the name of the metrics to be used to publish the metric
Method Detail

set

public void set(int newValue)
Set the value

Parameters:
newValue -

get

public int get()
Get value

Returns:
the value last set

inc

public void inc(int incr)
Inc metrics for incr vlaue

Parameters:
incr - - value to be added

inc

public void inc()
Inc metrics by one


dec

public void dec(int decr)
Inc metrics for incr vlaue

Parameters:
decr - - value to subtract

dec

public void dec()
Dec metrics by one


pushMetric

public void pushMetric(MetricsRecord mr)
Push the metric to the mr. The metric is pushed only if it was updated since last push Note this does NOT push to JMX (JMX gets the info via get()

Parameters:
mr -


Copyright © 2008 The Apache Software Foundation