com.ibm.websphere.pmi.stat

Interface WSStats


  1. public interface WSStats
WebSphere Performance Monitoring Infrastructure (PMI) Stats interface. This interface is similar to javax.management.j2ee.statistics.Stats interface. There are two ways to access stats:
  1. via MBean stats attribute
  2. via WebSphere Perf MBean
When using the MBean stats attribute an object of type javax.management.j2ee.statistics.Stats will be returned. If the MBean has a specific stats interface defined in the J2EE specification then an object of that specific type will be returned. For example, if the target MBean type is JVM then the return type will be javax.management.j2ee.statistics.JVMStats.

When using the Perf MBean an object of type com.ibm.websphere.pmi.stat.WSStats will be returned. The Perf MBean doesn't provide support for specific stats interface like JVMStats. The following example explains how to get the individual statistic from WSStat interface.

    ObjectName perfMBean;   // get Perf MBean (MBean type=Perf)
    String query = "WebSphere:type=perf,node=" + nodeName + ",process=" + serverName + ",*";
        ObjectName queryName = new ObjectName(query);
        Set s = adminClient.queryNames(queryName, null);
        if (!s.isEmpty())
      perfMBean = (ObjectName)s.iterator().next();

    ObjectName jvmMBean;    // get JVM MBean  in the same way as above with type JVM(MBean type=JVM)

    // invoke getStatsObject on perfMBean
    signature = new String[] {"javax.management.ObjectName","java.lang.Boolean"};
    params = new Object[] {jvmMBean, new Boolean(false)};
    WSStats jvmStats = (WSStats) ac.invoke(perfMBean, "getStatsObject", params, signature);

    // get JVM Heap size.
    //  WSJVMStats interface defines all the statistics that are available from JVM
    WSRangeStatistic jvmHeapStatistic = (WSRangeStatistic) jvmStats.getStatistic (WSJVMStats.HeapSize);
    long heapSize = jvmHeapStatistic.getCurrent();

    // print all statistics
    System.out.println (jvmStats.toString());
 
WebSphere Performance Monitoring Infrastructure (PMI) maintains the Stats from various components in a tree structure. Refer to the Perf MBean documentation for details about Perf MBean API.

Method Summary

Modifier and Type Method and Description
  1. int
getLevel()
Deprecated. No replacement
  1. java.lang.String
getName()
Returns the Stats name (eg., JVM Runtime, Thread Pools)
  1. WSStatistic
getStatistic(int id)
Get Statistic by ID.
  1. WSStatistic
getStatistic(java.lang.String statisticName)
Get Statistic by Name.
  1. java.lang.String[]
getStatisticNames()
Get Statistic names
  1. WSStatistic[]
getStatistics()
Get all statistics
  1. WSStats
getStats(java.lang.String name)
Get the sub-module stats by the name
  1. java.lang.String
getStatsType()
Returns the Stats type (eg., jvmRuntimeModule, threadPoolModule).
  1. WSStats[]
getSubStats()
Get all the sub-module stats
  1. long
getTime()
Returns the time when the client request came to the server
  1. int
getType()
Deprecated. No replacement
  1. java.lang.String[]
listStatisticNames()
Deprecated. As of 6.0, replaced by getStatisticNames()
  1. WSStatistic[]
listStatistics()
Deprecated. As of 6.0, replaced by getStatistics()
  1. WSStats[]
listSubStats()
Deprecated. As of 6.0, replaced by getSubStats()
  1. int
numStatistics()
Returns the number of statistics available in this Stats object (this number doesn't include the sub-module stats).
  1. void
resetOnClient(boolean recursive)
Reset the statistic (the statistic is reset only in the client side and not in the server side).
  1. void
setConfig(PmiModuleConfig config)
Set textual information.
  1. java.lang.String
toString()
Returns the Stats in String format
  1. java.lang.String
toXML()
Returns the Stats in XML format
  1. void
update(WSStats newStats,boolean keepOld,boolean recursiveUpdate)
Update the Stats object

Method Detail

getName

  1. java.lang.String getName()
Returns the Stats name (eg., JVM Runtime, Thread Pools)

getStatsType

  1. java.lang.String getStatsType()
Returns the Stats type (eg., jvmRuntimeModule, threadPoolModule). This type is used to bind the text information like name, description and unit to the Stats.

getTime

  1. long getTime()
Returns the time when the client request came to the server

setConfig

  1. void setConfig(PmiModuleConfig config)
Set textual information. If the text information like name, description, and unit are null then this method can be used to bind the text information to the Stats. The text information will be set by default.
See Also:

getStatistic

  1. WSStatistic getStatistic(int id)
Get Statistic by ID. The IDs are defined in com.ibm.websphere.pmi.stat.WS*Stats interface.

getStatistic

  1. WSStatistic getStatistic(java.lang.String statisticName)
Get Statistic by Name.

getStatisticNames

  1. java.lang.String[] getStatisticNames( )
Get Statistic names

getStatistics

  1. WSStatistic[] getStatistics()
Get all statistics

getStats

  1. WSStats getStats(java.lang.String name)
Get the sub-module stats by the name

getSubStats

  1. WSStats[] getSubStats()
Get all the sub-module stats

numStatistics

  1. int numStatistics()
Returns the number of statistics available in this Stats object (this number doesn't include the sub-module stats).

listStatistics

  1. WSStatistic[] listStatistics()
Deprecated. As of 6.0, replaced by getStatistics()
Returns all the statistics

listSubStats

  1. WSStats[] listSubStats()
Deprecated. As of 6.0, replaced by getSubStats()
Returns all the sub-module statistics

listStatisticNames

  1. java.lang.String[] listStatisticNames( )
Deprecated. As of 6.0, replaced by getStatisticNames()
Returns all the statistic names

update

  1. void update(WSStats newStats,
  2. boolean keepOld,
  3. boolean recursiveUpdate)
Update the Stats object
Parameters:
newStats - the new value of the Stats
keepOld - indicates if the the statistics/subStats that are not in newStats should be removed
recursiveUpdate - recursively update the sub-module stats when it is true

resetOnClient

  1. void resetOnClient(boolean recursive)
Reset the statistic (the statistic is reset only in the client side and not in the server side).

toXML

  1. java.lang.String toXML()
Returns the Stats in XML format

toString

  1. java.lang.String toString()
Returns the Stats in String format
Overrides:
toString in class java.lang.Object

getType

  1. int getType()
Deprecated. No replacement
Returns the PMI collection type

getLevel

  1. int getLevel()
Deprecated. No replacement
Returns the PMI instrumentation level