org.apache.hadoop.metrics.util
Class MetricsDynamicMBeanBase

java.lang.Object
  extended by org.apache.hadoop.metrics.util.MetricsDynamicMBeanBase
All Implemented Interfaces:
javax.management.DynamicMBean
Direct Known Subclasses:
RpcActivityMBean

public abstract class MetricsDynamicMBeanBase
extends java.lang.Object
implements javax.management.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
protected MetricsDynamicMBeanBase(MetricsRegistry mr, java.lang.String aMBeanDescription)
           
 
Method Summary
 java.lang.Object getAttribute(java.lang.String attributeName)
           
 javax.management.AttributeList getAttributes(java.lang.String[] attributeNames)
           
 javax.management.MBeanInfo getMBeanInfo()
           
 java.lang.Object invoke(java.lang.String actionName, java.lang.Object[] parms, java.lang.String[] signature)
           
 void setAttribute(javax.management.Attribute attribute)
           
 javax.management.AttributeList setAttributes(javax.management.AttributeList attributes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetricsDynamicMBeanBase

protected MetricsDynamicMBeanBase(MetricsRegistry mr,
                                  java.lang.String aMBeanDescription)
Method Detail

getAttribute

public java.lang.Object getAttribute(java.lang.String attributeName)
                              throws javax.management.AttributeNotFoundException,
                                     javax.management.MBeanException,
                                     javax.management.ReflectionException
Specified by:
getAttribute in interface javax.management.DynamicMBean
Throws:
javax.management.AttributeNotFoundException
javax.management.MBeanException
javax.management.ReflectionException

getAttributes

public javax.management.AttributeList getAttributes(java.lang.String[] attributeNames)
Specified by:
getAttributes in interface javax.management.DynamicMBean

getMBeanInfo

public javax.management.MBeanInfo getMBeanInfo()
Specified by:
getMBeanInfo in interface javax.management.DynamicMBean

invoke

public java.lang.Object invoke(java.lang.String actionName,
                               java.lang.Object[] parms,
                               java.lang.String[] signature)
                        throws javax.management.MBeanException,
                               javax.management.ReflectionException
Specified by:
invoke in interface javax.management.DynamicMBean
Throws:
javax.management.MBeanException
javax.management.ReflectionException

setAttribute

public void setAttribute(javax.management.Attribute attribute)
                  throws javax.management.AttributeNotFoundException,
                         javax.management.InvalidAttributeValueException,
                         javax.management.MBeanException,
                         javax.management.ReflectionException
Specified by:
setAttribute in interface javax.management.DynamicMBean
Throws:
javax.management.AttributeNotFoundException
javax.management.InvalidAttributeValueException
javax.management.MBeanException
javax.management.ReflectionException

setAttributes

public javax.management.AttributeList setAttributes(javax.management.AttributeList attributes)
Specified by:
setAttributes in interface javax.management.DynamicMBean


Copyright © 2009 The Apache Software Foundation