com.ibm.wsspi.pmi.factory
Class StatsFactory
- java.lang.Object
com.ibm.wsspi.pmi.factory.StatsFactory
- public class StatsFactory
- extends java.lang.Object
The following steps are required to instrument a component using Custom PMI:
- Define a Stats template
- Create Stats object using StatsFactory
- Instrument code and update the Stats object.
StatsFactory allows runtime component to create a custom Stats/PMI (Stats is the J2EE terminology) module using an XML template. The template
should follow the DTD com/ibm/websphere/pmi/xml/stats.dtd
.
The statistics created via Custom PMI will be available to the external client programs via JMX MBean and PMI API. The Custom PMI will support all the Statistic types (CountStatistic, TimeStatistic, etc.) defined in the J2EE 1.4 Performance Data Framework. The Custom PMI cannot support any user-defined Statistic type.
This factory class can create objects of type StatsInstance and StatsGroup. The StatsInstance/StatsGroup will be part of the Performance Monitoring Infrastructure (PMI) tree structure. Each StatsInstance/StatsGroup is identified by a unique name in the PMI tree. It is suggested that the name be prefixed with the component/product name. By default each StatsInstance/StatsGroup will be added to the PMI tree at the root level. StatsFactory allows to add a StatsInstance/StatsGroup to a parent StatsInstance/StatsGroup.
Each StatsInstance or StatsGroup should be associated with an MBean in order to access the statistics via JMX interface. There are two ways to access the statistics via JMX:
- via managed object
- via Perf MBean
In order to access the statistics via managed object MBean the user should provide the MBean when creating the StatsInstance or StatsGroup.
All Stats (with or without an MBean) can be fetched via the Perf MBean.
Stats without an MBean is identified using the StatDescriptor
. Stats with an MBean can be identified using the StatDescriptor
or the javax.management.ObjectName
.
Constructor Summary
Constructor and Description |
---|
StatsFactory()
|
Method Summary
Modifier and Type | Method and Description |
---|---|
|
createStatsGroup(java.lang.String groupName,java.lang.String statsTemplate,javax.management.ObjectName mBean)
Create a StatsGroup using the Stats template and add to the PMI tree at the root level.
|
|
createStatsGroup(java.lang.String groupName,java.lang.String statsTemplate,StatsGroup parentGroup,javax.management.ObjectName mBean)
Create a StatsGroup using the Stats template and add to the PMI tree under the specified parent group.
|
|
createStatsGroup(java.lang.String groupName,java.lang.String statsTemplate,StatsInstance parentInstance,javax.management.ObjectName mBean)
Create a StatsGroup using the Stats template and add to the PMI tree under the specified parent instance.
|
|
createStatsInstance(java.lang.String instanceName,StatsGroup parentGroup,javax.management.ObjectName mBean,com.ibm.wsspi.pmi.factory.StatisticActionListener listener)
Deprecated. As of 6.1, replaced by createStatsInstance(String, StatsGroup, ObjectName, StatisticActions ).
|
|
createStatsInstance(java.lang.String instanceName,StatsGroup parentGroup,javax.management.ObjectName mBean,StatisticActions listener)
Create a StatsInstance under the specified parent group.
|
|
createStatsInstance(java.lang.String instanceName,java.lang.String statsTemplate,javax.management.ObjectName mBean,com.ibm.wsspi.pmi.factory.StatisticActionListener listener)
Deprecated. As of 6.1, replaced by createStatsInstance(String, String, ObjectName, StatisticActions ).
|
|
createStatsInstance(java.lang.String instanceName,java.lang.String statsTemplate,javax.management.ObjectName mBean,StatisticActions listener)
Create a StatsInstance using the Stats template and add to the PMI tree at the root level.
|
|
createStatsInstance(java.lang.String instanceName,java.lang.String statsTemplate,StatsGroup parentGroup,javax.management.ObjectName mBean,com.ibm.wsspi.pmi.factory.StatisticActionListener listener)
Deprecated. As of 6.1, replaced by createStatsInstance(String, String, StatsGroup, StatsGroup, ObjectName, StatisticActions ).
|
|
createStatsInstance(java.lang.String instanceName,java.lang.String statsTemplate,StatsGroup parentGroup,javax.management.ObjectName mBean,StatisticActions listener)
Create a StatsInstance using the template and add to the PMI tree under the specified parent group.
|
|
getStatsGroup(java.lang.String[] path)
This method may be used to retrieve an existing StatsGroup object.
|
|
getStatsInstance(java.lang.String[] path)
This method may be used to retrieve an existing StatsInstance object.
|
|
isPMIEnabled()
Returns PMI service status.
|
|
registerStatsTemplateLookup(StatsTemplateLookup lookupClass)
Registers a StatsTemplateLookup object with the PMI service (WebSphere internal use only).
|
|
removeStatsGroup(StatsGroup group)
Removes a StatsGroup from the PMI tree.
|
|
removeStatsInstance(StatsInstance instance)
Removes a StatsInstance from the PMI tree.
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail
StatsFactory
- public StatsFactory()
Method Detail
isPMIEnabled
- public static boolean isPMIEnabled( )
createStatsGroup
- public static StatsGroup createStatsGroup( java.lang.String groupName,
- java.lang.String statsTemplate,
- javax.management.ObjectName mBean)
- throws StatsFactoryException
groupName
- name of the group statsTemplate
- location of the Stats template XML file mBean
- MBean that needs to be associated with the Stats group StatsFactoryException
- if error while creating Stats group createStatsGroup
- public static StatsGroup createStatsGroup( java.lang.String groupName,
- java.lang.String statsTemplate,
- StatsGroup parentGroup,
- javax.management.ObjectName mBean)
- throws StatsFactoryException
groupName
- name of the group statsTemplate
- location of the Stats template XML file parentGroup
- parent Stats group mBean
- MBean that needs to be associated with the Stats group StatsFactoryException
- if error while creating Stats group createStatsGroup
- public static StatsGroup createStatsGroup( java.lang.String groupName,
- java.lang.String statsTemplate,
- StatsInstance parentInstance,
- javax.management.ObjectName mBean)
- throws StatsFactoryException
groupName
- name of the group statsTemplate
- location of the Stats template XML file parentInstance
- parent Stats instance mBean
- MBean that needs to be associated with the Stats group StatsFactoryException
- if error while creating Stats group createStatsInstance
- public static StatsInstance createStatsInstance( java.lang.String instanceName,
- java.lang.String statsTemplate,
- javax.management.ObjectName mBean,
- com.ibm.wsspi.pmi.factory.StatisticActionListener listener)
- throws StatsFactoryException
instanceName
- name of the instance statsTemplate
- location of the Stats template XML file mBean
- MBean that needs to be associated with the Stats instance listener
- a StatisticActionListener object. This object will be called when a statistic is created for this instance StatsFactoryException
- if error while creating Stats instance createStatsInstance
- public static StatsInstance createStatsInstance( java.lang.String instanceName,
- java.lang.String statsTemplate,
- javax.management.ObjectName mBean,
- StatisticActions listener)
- throws StatsFactoryException
instanceName
- name of the instance statsTemplate
- location of the Stats template XML file mBean
- MBean that needs to be associated with the Stats instance listener
- A StatisticActions object. This object will be called when events occur on statistics created for this instance StatsFactoryException
- if error while creating Stats instance createStatsInstance
- public static StatsInstance createStatsInstance( java.lang.String instanceName,
- StatsGroup parentGroup,
- javax.management.ObjectName mBean,
- com.ibm.wsspi.pmi.factory.StatisticActionListener listener)
- throws StatsFactoryException
instanceName
- name of the instance parentGroup
- parent Stats group mBean
- MBean that needs to be associated with the Stats instance listener
- a StatisticActionListener object. This object will be called when a statistic is created for this instance StatsFactoryException
- if error while creating Stats instance createStatsInstance
- public static StatsInstance createStatsInstance( java.lang.String instanceName,
- StatsGroup parentGroup,
- javax.management.ObjectName mBean,
- StatisticActions listener)
- throws StatsFactoryException
instanceName
- name of the instance parentGroup
- parent Stats group mBean
- MBean that needs to be associated with the Stats instance listener
- A StatisticActions object. This object will be called when events occur on statistics created for this instance StatsFactoryException
- if error while creating Stats instance createStatsInstance
- public static StatsInstance createStatsInstance( java.lang.String instanceName,
- java.lang.String statsTemplate,
- StatsGroup parentGroup,
- javax.management.ObjectName mBean,
- com.ibm.wsspi.pmi.factory.StatisticActionListener listener)
- throws StatsFactoryException
instanceName
- name of the instance statsTemplate
- location of the Stats template XML file parentGroup
- parent Stats group mBean
- MBean that needs to be associated with the Stats instance listener
- a StatisticActionListener object. This object will be called when a statistic is created for this instance StatsFactoryException
- if error while creating Stats instance createStatsInstance
- public static StatsInstance createStatsInstance( java.lang.String instanceName,
- java.lang.String statsTemplate,
- StatsGroup parentGroup,
- javax.management.ObjectName mBean,
- StatisticActions listener)
- throws StatsFactoryException
instanceName
- name of the instance statsTemplate
- location of the Stats template XML file parentGroup
- parent Stats group mBean
- MBean that needs to be associated with the Stats instance listener
- A StatisticActions object. This object will be called when events occur on statistics created for this instance StatsFactoryException
- if error while creating Stats instance removeStatsInstance
- public static void removeStatsInstance( StatsInstance instance)
- throws StatsFactoryException
instance
- StatsInstance to be removed StatsFactoryException
- if error while removing Stats instance removeStatsGroup
- public static void removeStatsGroup( StatsGroup group)
- throws StatsFactoryException
group
- StatsGroup to be removed StatsFactoryException
- if error while removing Stats group registerStatsTemplateLookup
- public static void registerStatsTemplateLookup( StatsTemplateLookup lookupClass)
lookupClass
- An instance of StatsTemplateLookup
getStatsGroup
- public static StatsGroup getStatsGroup( java.lang.String[] path)
path
- A String array. The string elements in this parameter specify the hierarchy of the stats group being retrieved. If no stats group is found matching the path provided, the response object will be null. getStatsInstance
- public static StatsInstance getStatsInstance( java.lang.String[] path)
path
- A String array. The string elements in this parameter specify the hierarchy of the stats instance being retrieved. If no stats instance is found matching the path provided, the response object will be null.