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);
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMetricsDynamicMBeanBase(MetricsRegistry mr, String aMBeanDescription) -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String attributeName) getAttributes(String[] attributeNames) voidsetAttribute(Attribute attribute) setAttributes(AttributeList attributes)
-
Constructor Details
-
MetricsDynamicMBeanBase
-
-
Method Details
-
getAttribute
public Object getAttribute(String attributeName) throws AttributeNotFoundException, MBeanException, ReflectionException - Specified by:
getAttributein interfaceDynamicMBean- Throws:
AttributeNotFoundExceptionMBeanExceptionReflectionException
-
getAttributes
- Specified by:
getAttributesin interfaceDynamicMBean
-
getMBeanInfo
- Specified by:
getMBeanInfoin interfaceDynamicMBean
-
invoke
public Object invoke(String actionName, Object[] parms, String[] signature) throws MBeanException, ReflectionException - Specified by:
invokein interfaceDynamicMBean- Throws:
MBeanExceptionReflectionException
-
setAttribute
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException - Specified by:
setAttributein interfaceDynamicMBean- Throws:
AttributeNotFoundExceptionInvalidAttributeValueExceptionMBeanExceptionReflectionException
-
setAttributes
- Specified by:
setAttributesin interfaceDynamicMBean
-