org.apache.hadoop.metrics2.impl
Class MetricsSystemImpl

java.lang.Object
  extended by org.apache.hadoop.metrics2.impl.MetricsSystemImpl
All Implemented Interfaces:
MetricsSystem, MetricsSystemMXBean

public class MetricsSystemImpl
extends Object
implements MetricsSystem

A base class for metrics system singletons


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.hadoop.metrics2.MetricsSystem
MetricsSystem.AbstractCallback, MetricsSystem.Callback
 
Constructor Summary
MetricsSystemImpl()
          Construct the system but not initializing (read config etc.) it.
MetricsSystemImpl(String prefix)
          Construct the metrics system
 
Method Summary
 String currentConfig()
           
 void init(String prefix)
          Initialized the metrics system with a prefix.
 void refreshMBeans()
          Force a refresh of MBeans
 void register(MetricsSystem.Callback callback)
          Register a callback interface for JMX events
<T extends MetricsSink>
T
register(String name, String description, 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.
 void start()
          Start the metrics system
 void stop()
          Stop the metrics system
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetricsSystemImpl

public MetricsSystemImpl(String prefix)
Construct the metrics system

Parameters:
prefix - for the system

MetricsSystemImpl

public MetricsSystemImpl()
Construct the system but not initializing (read config etc.) it.

Method Detail

init

public void init(String prefix)
Initialized the metrics system with a prefix.

Parameters:
prefix - the system will look for configs with the prefix

start

public void start()
Description copied from interface: MetricsSystemMXBean
Start the metrics system

Specified by:
start in interface MetricsSystemMXBean

stop

public void stop()
Description copied from interface: MetricsSystemMXBean
Stop the metrics system

Specified by:
stop in interface MetricsSystemMXBean

register

public <T extends MetricsSource> T register(String name,
                                            String desc,
                                            T source)
Description copied from interface: MetricsSystem
Register a metrics source

Specified by:
register in interface MetricsSystem
Type Parameters:
T - the type of the source
Parameters:
name - of the source. Must be unique.
desc - the description of the source.
source - to register
Returns:
the source

register

public <T extends MetricsSink> T register(String name,
                                          String description,
                                          T sink)
Description copied from interface: MetricsSystem
Register a metrics sink

Specified by:
register in interface MetricsSystem
Type Parameters:
T - the type of the sink
Parameters:
name - of the sink. Must be unique.
description - the description of the sink
sink - to register
Returns:
the sink

register

public void register(MetricsSystem.Callback callback)
Description copied from interface: MetricsSystem
Register a callback interface for JMX events

Specified by:
register in interface MetricsSystem
Parameters:
callback - the callback object implementing the MBean interface.

refreshMBeans

public void refreshMBeans()
Description copied from interface: MetricsSystemMXBean
Force a refresh of MBeans

Specified by:
refreshMBeans in interface MetricsSystemMXBean

currentConfig

public String currentConfig()
Specified by:
currentConfig in interface MetricsSystemMXBean
Returns:
the current config Note, avoid getConfig, as it'll turn it into an attribute, which doesn't support multiple lines in the values.

shutdown

public void shutdown()
Description copied from interface: MetricsSystem
Shutdown the metrics system completely (usually during server shutdown.) The MetricsSystemMXBean will be unregistered.

Specified by:
shutdown in interface MetricsSystem


Copyright © 2009 The Apache Software Foundation