Class MetricsDynamicMBeanBase

java.lang.Object
com.mapr.org.apache.hadoop.metrics.util.MetricsDynamicMBeanBase
All Implemented Interfaces:
DynamicMBean

@LimitedPrivate({"HDFS","MapReduce"}) public abstract class MetricsDynamicMBeanBase extends Object implements DynamicMBean
This abstract base class facilitates creating dynamic mbeans automatically from metrics. The metrics constructors registers metrics in a registry. Different categories of metrics should be in differnt classes with their own registry (as in NameNodeMetrics and DataNodeMetrics). Then the MBean can be created passing the registry to the constructor. The MBean should be then registered using a mbean name (example): MetricsHolder myMetrics = new MetricsHolder(); // has metrics and registry MetricsTestMBean theMBean = new MetricsTestMBean(myMetrics.mregistry); ObjectName mbeanName = MBeanUtil.registerMBean("ServiceFoo", "TestStatistics", theMBean);