org.rhq.enterprise.server.resource.group.definition.mbean
Class GroupDefinitionRecalculationThreadMonitor

java.lang.Object
  extended by org.rhq.enterprise.server.resource.group.definition.mbean.GroupDefinitionRecalculationThreadMonitor
All Implemented Interfaces:
MBeanRegistration, GroupDefinitionRecalculationThreadMonitorMBean

public class GroupDefinitionRecalculationThreadMonitor
extends Object
implements GroupDefinitionRecalculationThreadMonitorMBean, MBeanRegistration

An MBean that exposes call-time metrics for the cost of recalculating DynaGroups from their owning GroupDefinitions

Author:
Joseph Marques

Nested Class Summary
 class GroupDefinitionRecalculationThreadMonitor.GroupDefinitionRecalculationStatistic
           
 
Constructor Summary
GroupDefinitionRecalculationThreadMonitor()
           
 
Method Summary
 void clear()
          Clears the metrics data, starting all values back to 0 as if starting fresh.
 long getAutoRecalculatingGroupDefinitionCount()
          Returns the count of the number of group definitions currently set for auto-recalculation, this can never be greater than GroupDefinitionRecalculationThreadMonitorMBean.getGroupDefinitionCount()
 long getAutoRecalculationThreadTime()
          Returns the time (in millis) that it took to recalculate all of the DynaGroups in the system whose owning GroupDefinition was set to automatically recalculate on a periodic basis (this metric only reflects the last known / collected time for the recalculation thread)
 long getDynaGroupCount()
          Returns the count of the number of ResourceGroups in the system current managed by some GroupDefinition
 long getGroupDefinitionCount()
          Returns the count of the total number of group definitions currently managed by the system
static GroupDefinitionRecalculationThreadMonitorMBean getMBean()
           
 Map<String,Map<String,Object>> getStatistics()
          Returns a map of statistics broken down by group definition.
 void postDeregister()
           
 void postRegister(Boolean registrationDone)
           
 void preDeregister()
           
 ObjectName preRegister(MBeanServer server, ObjectName name)
           
 void updateAutoRecalculationThreadTime(long timeInMillis)
          Sets the time (in millis) that it took to recalculate all of the DynaGroups in the system whose owning GroupDefinition was set to automatically recalculate on a periodic basis (this metric only reflects the last known / collected time for the recalculation thread)
 void updateStatistic(String groupDefinitionName, int newDynaGroupCount, boolean success, long executionTime)
          Updates the internal GroupDefinitionRecalculationThreadMonitor.GroupDefinitionRecalculationStatistic for the GroupDefinition with the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupDefinitionRecalculationThreadMonitor

public GroupDefinitionRecalculationThreadMonitor()
Method Detail

getMBean

public static GroupDefinitionRecalculationThreadMonitorMBean getMBean()

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws Exception
Specified by:
preRegister in interface MBeanRegistration
Throws:
Exception

clear

public void clear()
Description copied from interface: GroupDefinitionRecalculationThreadMonitorMBean
Clears the metrics data, starting all values back to 0 as if starting fresh.

Specified by:
clear in interface GroupDefinitionRecalculationThreadMonitorMBean

getGroupDefinitionCount

public long getGroupDefinitionCount()
Description copied from interface: GroupDefinitionRecalculationThreadMonitorMBean
Returns the count of the total number of group definitions currently managed by the system

Specified by:
getGroupDefinitionCount in interface GroupDefinitionRecalculationThreadMonitorMBean
Returns:
count of the total number of group definitions currently managed by the system

getAutoRecalculatingGroupDefinitionCount

public long getAutoRecalculatingGroupDefinitionCount()
Description copied from interface: GroupDefinitionRecalculationThreadMonitorMBean
Returns the count of the number of group definitions currently set for auto-recalculation, this can never be greater than GroupDefinitionRecalculationThreadMonitorMBean.getGroupDefinitionCount()

Specified by:
getAutoRecalculatingGroupDefinitionCount in interface GroupDefinitionRecalculationThreadMonitorMBean
Returns:
count of the number of group definitions currently set for auto-recalculation, this can never be greater than GroupDefinitionRecalculationThreadMonitorMBean.getGroupDefinitionCount()

getDynaGroupCount

public long getDynaGroupCount()
Description copied from interface: GroupDefinitionRecalculationThreadMonitorMBean
Returns the count of the number of ResourceGroups in the system current managed by some GroupDefinition

Specified by:
getDynaGroupCount in interface GroupDefinitionRecalculationThreadMonitorMBean
Returns:
count of the number of ResourceGroups in the system current managed by some GroupDefinition

getAutoRecalculationThreadTime

public long getAutoRecalculationThreadTime()
Description copied from interface: GroupDefinitionRecalculationThreadMonitorMBean
Returns the time (in millis) that it took to recalculate all of the DynaGroups in the system whose owning GroupDefinition was set to automatically recalculate on a periodic basis (this metric only reflects the last known / collected time for the recalculation thread)

Specified by:
getAutoRecalculationThreadTime in interface GroupDefinitionRecalculationThreadMonitorMBean
Returns:
the time (in millis) that it took to recalculate all of the DynaGroups in the system whose owning GroupDefinition was set to automatically recalculate on a periodic basis (this metric only reflects the last known / collected time for the recalculation thread)

updateAutoRecalculationThreadTime

public void updateAutoRecalculationThreadTime(long timeInMillis)
Description copied from interface: GroupDefinitionRecalculationThreadMonitorMBean
Sets the time (in millis) that it took to recalculate all of the DynaGroups in the system whose owning GroupDefinition was set to automatically recalculate on a periodic basis (this metric only reflects the last known / collected time for the recalculation thread)

Specified by:
updateAutoRecalculationThreadTime in interface GroupDefinitionRecalculationThreadMonitorMBean
Parameters:
timeInMillis - the time (in millis) that it took to recalculate all of the DynaGroups in the system whose owning GroupDefinition was set to automatically recalculate on a periodic basis (this metric only reflects the last known / collected time for the recalculation thread)

updateStatistic

public void updateStatistic(String groupDefinitionName,
                            int newDynaGroupCount,
                            boolean success,
                            long executionTime)
Description copied from interface: GroupDefinitionRecalculationThreadMonitorMBean
Updates the internal GroupDefinitionRecalculationThreadMonitor.GroupDefinitionRecalculationStatistic for the GroupDefinition with the given name.

Specified by:
updateStatistic in interface GroupDefinitionRecalculationThreadMonitorMBean
Parameters:
groupDefinitionName - the name of the GroupDefinition whose internal statistics will be updated
newDynaGroupCount - the count of the number of DynaGroups managed by this GroupDefinition
success - whether or not the last recalculation was successful; if successful, newDynaGroupCount will reflect the count after recalculation, otherwise it will reflect the last known count
executionTime - the time (in millis) that it took to recalculate this GroupDefinition

getStatistics

public Map<String,Map<String,Object>> getStatistics()
Description copied from interface: GroupDefinitionRecalculationThreadMonitorMBean
Returns a map of statistics broken down by group definition.

Specified by:
getStatistics in interface GroupDefinitionRecalculationThreadMonitorMBean
Returns:
complex data

postRegister

public void postRegister(Boolean registrationDone)
Specified by:
postRegister in interface MBeanRegistration

preDeregister

public void preDeregister()
                   throws Exception
Specified by:
preDeregister in interface MBeanRegistration
Throws:
Exception

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface MBeanRegistration


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.