com.ibm.websphere.pmi.stat

Interface WSStats



  • 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 Detail

      • getName

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

        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

        long getTime()
        Returns the time when the client request came to the server
      • setConfig

        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:
        WSStatsHelper
      • getStatistic

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

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

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

        WSStatistic[] getStatistics()
        Get all statistics
      • getStats

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

        WSStats[] getSubStats()
        Get all the sub-module stats
      • numStatistics

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

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

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

        void update(WSStats newStats,
                  boolean keepOld,
                  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

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

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

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

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

        int getLevel()
        Deprecated. No replacement
        Returns the PMI instrumentation level
IBM WebSphere Application ServerTM
Release 9.0