org.apache.hadoop.metrics.util
Class MetricsLongValue

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

public class MetricsLongValue
extends Object

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

Constructor Detail

MetricsLongValue

public MetricsLongValue(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(long newValue)
Set the value

Parameters:
newValue -

get

public long get()
Get value

Returns:
the value last set

inc

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

Parameters:
incr - - value to be added

inc

public void inc()
Inc metrics by one


dec

public void dec(long 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