org.apache.hadoop.metrics.util
Class MetricsDynamicMBeanBase
java.lang.Object
org.apache.hadoop.metrics.util.MetricsDynamicMBeanBase
- All Implemented Interfaces:
- DynamicMBean
- Direct Known Subclasses:
- RpcActivityMBean
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);
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MetricsDynamicMBeanBase
protected MetricsDynamicMBeanBase(MetricsRegistry mr,
String aMBeanDescription)
getAttribute
public Object getAttribute(String attributeName)
throws AttributeNotFoundException,
MBeanException,
ReflectionException
- Specified by:
getAttribute
in interface DynamicMBean
- Throws:
AttributeNotFoundException
MBeanException
ReflectionException
getAttributes
public AttributeList getAttributes(String[] attributeNames)
- Specified by:
getAttributes
in interface DynamicMBean
getMBeanInfo
public MBeanInfo getMBeanInfo()
- Specified by:
getMBeanInfo
in interface DynamicMBean
invoke
public Object invoke(String actionName,
Object[] parms,
String[] signature)
throws MBeanException,
ReflectionException
- Specified by:
invoke
in interface DynamicMBean
- Throws:
MBeanException
ReflectionException
setAttribute
public void setAttribute(Attribute attribute)
throws AttributeNotFoundException,
InvalidAttributeValueException,
MBeanException,
ReflectionException
- Specified by:
setAttribute
in interface DynamicMBean
- Throws:
AttributeNotFoundException
InvalidAttributeValueException
MBeanException
ReflectionException
setAttributes
public AttributeList setAttributes(AttributeList attributes)
- Specified by:
setAttributes
in interface DynamicMBean
Copyright © 2009 The Apache Software Foundation