org.apache.hadoop.metrics2
Interface MetricsSystem

All Superinterfaces:
MetricsSystemMXBean
All Known Implementing Classes:
DefaultMetricsSystem, MetricsSystemImpl

public interface MetricsSystem
extends MetricsSystemMXBean

The metrics system interface


Nested Class Summary
static class MetricsSystem.AbstractCallback
          Convenient abstract class for implementing callback interface
static interface MetricsSystem.Callback
          The metrics system callback interface
 
Method Summary
 void publishMetricsNow()
          Requests an immediate publish of all metrics from sources to sinks.
 void register(MetricsSystem.Callback callback)
          Register a callback interface for JMX events
<T extends MetricsSink>
T
register(String name, String desc, T sink)
          Register a metrics sink
<T extends MetricsSource>
T
register(String name, String desc, T source)
          Register a metrics source
 void shutdown()
          Shutdown the metrics system completely (usually during server shutdown.) The MetricsSystemMXBean will be unregistered.
 
Methods inherited from interface org.apache.hadoop.metrics2.MetricsSystemMXBean
currentConfig, refreshMBeans, start, stop
 

Method Detail

register

<T extends MetricsSource> T register(String name,
                                     String desc,
                                     T source)
Register a metrics source

Type Parameters:
T - the type of the source
Parameters:
source - to register
name - of the source. Must be unique.
desc - the description of the source.
Returns:
the source
Throws:
MetricsException

register

<T extends MetricsSink> T register(String name,
                                   String desc,
                                   T sink)
Register a metrics sink

Type Parameters:
T - the type of the sink
Parameters:
sink - to register
name - of the sink. Must be unique.
desc - the description of the sink
Returns:
the sink
Throws:
MetricsException

register

void register(MetricsSystem.Callback callback)
Register a callback interface for JMX events

Parameters:
callback - the callback object implementing the MBean interface.

publishMetricsNow

void publishMetricsNow()
Requests an immediate publish of all metrics from sources to sinks. This is a "soft" request: the expectation is that a best effort will be done to synchronously snapshot the metrics from all the sources and put them in all the sinks (including flushing the sinks) before returning to the caller. If this can't be accomplished in reasonable time it's OK to return to the caller before everything is done.


shutdown

void shutdown()
Shutdown the metrics system completely (usually during server shutdown.) The MetricsSystemMXBean will be unregistered.



Copyright © 2009 The Apache Software Foundation