org.apache.hadoop.metrics2.lib
Class MetricMutable

java.lang.Object
  extended by org.apache.hadoop.metrics2.lib.MetricMutable
Direct Known Subclasses:
MetricMutableCounter, MetricMutableGauge, MetricMutableStat

public abstract class MetricMutable
extends Object

The mutable metric interface


Field Summary
 String description
          description of the metric
 String name
          name of the metric
 
Constructor Summary
MetricMutable(String name, String description)
          Construct a mutable metric
 
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 sampe/snapshot of metric if changed
abstract  void snapshot(MetricsRecordBuilder builder, boolean all)
          Get a snapshot/snapshot of the metric
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public final String name
name of the metric


description

public final String description
description of the metric

Constructor Detail

MetricMutable

public MetricMutable(String name,
                     String description)
Construct a mutable metric

Parameters:
name - of the metric
description - of the metric
Method Detail

snapshot

public abstract void snapshot(MetricsRecordBuilder builder,
                              boolean all)
Get a snapshot/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 sampe/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 © 2009 The Apache Software Foundation