org.apache.hivemind.management.mbeans
Class PerformanceMonitorMBean

java.lang.Object
  extended bymx4j.AbstractDynamicMBean
      extended byorg.apache.hivemind.management.mbeans.PerformanceMonitorMBean
All Implemented Interfaces:
javax.management.DynamicMBean, PerformanceCollector

public class PerformanceMonitorMBean
extends mx4j.AbstractDynamicMBean
implements PerformanceCollector

MBean that holds and calculates the performance data for service method calls intercepted by the performanceMonitorinterceptor. Creates for each intercepted method 5 MBean attributes: Number of Calls, Minimum, maximum, average and last execution time

Since:
1.1
Author:
Achim Huegen

Field Summary
protected static java.lang.String DATA_TYPE_AVERAGE_TIME
           
protected static java.lang.String DATA_TYPE_COUNT
           
protected static java.lang.String DATA_TYPE_LAST_TIME
           
protected static java.lang.String DATA_TYPE_MAXIMUM_TIME
           
protected static java.lang.String DATA_TYPE_MINIMUM_TIME
           
 
Constructor Summary
PerformanceMonitorMBean(java.util.Set methods)
          Creates a new instance
 
Method Summary
 void addMeasurement(org.apache.hivemind.service.MethodSignature method, long executionTime)
          Adds the measurement of a method execution
protected  java.lang.String buildAttributeName(org.apache.hivemind.service.MethodSignature method, java.lang.String performanceDataType)
          Builds the attribute name that holds the measurement data of type performanceDataType for the method
protected  javax.management.MBeanAttributeInfo[] createMBeanAttributeInfo()
           
 java.lang.Object getAttribute(java.lang.String attribute)
           
protected  void initAttributes()
          Creates for each intercepted method 5 MBean attributes: Number of Calls, Minimum, maximum, average and last execution time
protected  void initCounters()
          Builds two maps for accessing the counters by method signature and method id
 
Methods inherited from class mx4j.AbstractDynamicMBean
createMBeanConstructorInfo, createMBeanInfo, createMBeanNotificationInfo, createMBeanOperationInfo, findMethod, getAttributes, getMBeanClassName, getMBeanDescription, getMBeanInfo, getResource, invoke, invoke, invoke, invokeMethod, setAttribute, setAttributes, setMBeanInfo, setResource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATA_TYPE_MAXIMUM_TIME

protected static final java.lang.String DATA_TYPE_MAXIMUM_TIME
See Also:
Constant Field Values

DATA_TYPE_MINIMUM_TIME

protected static final java.lang.String DATA_TYPE_MINIMUM_TIME
See Also:
Constant Field Values

DATA_TYPE_LAST_TIME

protected static final java.lang.String DATA_TYPE_LAST_TIME
See Also:
Constant Field Values

DATA_TYPE_AVERAGE_TIME

protected static final java.lang.String DATA_TYPE_AVERAGE_TIME
See Also:
Constant Field Values

DATA_TYPE_COUNT

protected static final java.lang.String DATA_TYPE_COUNT
See Also:
Constant Field Values
Constructor Detail

PerformanceMonitorMBean

public PerformanceMonitorMBean(java.util.Set methods)
Creates a new instance

Parameters:
methods - Set with instances of MethodSignatureContains the methods for that calls can be counted by this MBean
Method Detail

initCounters

protected void initCounters()
Builds two maps for accessing the counters by method signature and method id


initAttributes

protected void initAttributes()
Creates for each intercepted method 5 MBean attributes: Number of Calls, Minimum, maximum, average and last execution time


buildAttributeName

protected java.lang.String buildAttributeName(org.apache.hivemind.service.MethodSignature method,
                                              java.lang.String performanceDataType)
Builds the attribute name that holds the measurement data of type performanceDataType for the method


addMeasurement

public void addMeasurement(org.apache.hivemind.service.MethodSignature method,
                           long executionTime)
Description copied from interface: PerformanceCollector
Adds the measurement of a method execution

Specified by:
addMeasurement in interface PerformanceCollector
Parameters:
method - the executed method
executionTime - the duration of the method execution
See Also:
PerformanceCollector.addMeasurement(MethodSignature, long)

createMBeanAttributeInfo

protected javax.management.MBeanAttributeInfo[] createMBeanAttributeInfo()

getAttribute

public java.lang.Object getAttribute(java.lang.String attribute)
                              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
See Also:
AbstractDynamicMBean.getAttribute(java.lang.String)