org.apache.hadoop.metrics2.lib
Class MutableMetric

java.lang.Object
  extended by org.apache.hadoop.metrics2.lib.MutableMetric
Direct Known Subclasses:
MutableCounter, MutableGauge, MutableQuantiles, MutableRates, MutableStat

@InterfaceAudience.Public
@InterfaceStability.Evolving
public abstract class MutableMetric
extends Object

The mutable metric interface


Constructor Summary
MutableMetric()
           
 
Method Summary
 boolean changed()
           
protected  void clearChanged()
          Clear the changed flag in the snapshot operations
protected  void setChanged()
          Set the changed flag in mutable operations
 void snapshot(MetricsRecordBuilder builder)
          Get a snapshot of metric if changed
abstract  void snapshot(MetricsRecordBuilder builder, boolean all)
          Get a snapshot of the metric
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MutableMetric

public MutableMetric()
Method Detail

snapshot

public abstract void snapshot(MetricsRecordBuilder builder,
                              boolean all)
Get a snapshot of the metric

Parameters:
builder - the metrics record builder
all - if true, snapshot unchanged metrics as well

snapshot

public void snapshot(MetricsRecordBuilder builder)
Get a snapshot of metric if changed

Parameters:
builder - the metrics record builder

setChanged

protected void setChanged()
Set the changed flag in mutable operations


clearChanged

protected void clearChanged()
Clear the changed flag in the snapshot operations


changed

public boolean changed()
Returns:
true if metric is changed since last snapshot/snapshot


Copyright © 2014 Apache Software Foundation. All Rights Reserved.