Search in sources :

Example 1 with BoundedRangeStatistic

use of org.glassfish.j2ee.statistics.BoundedRangeStatistic in project Payara by payara.

the class BeanCacheMonitorTest method testStats.

public void testStats() {
    final QueryMgr q = getQueryMgr();
    final Set beanCacheMonitors = q.queryJ2EETypeSet(XTypes.BEAN_CACHE_MONITOR);
    if (beanCacheMonitors.size() == 0) {
        warning("BeanCacheMonitorTest: no MBeans found to test.");
    } else {
        final Iterator iter = beanCacheMonitors.iterator();
        while (iter.hasNext()) {
            final BeanCacheMonitor m = (BeanCacheMonitor) iter.next();
            final EJBCacheStats s = m.getEJBCacheStats();
            // verify that we can get each Statistic; there was a problem at one time
            final BoundedRangeStatistic b1 = s.getCacheMisses();
            final BoundedRangeStatistic b2 = s.getCacheHits();
            final BoundedRangeStatistic b3 = s.getBeansInCache();
            // these were failing
            final CountStatistic c4 = s.getPassivationSuccesses();
            final CountStatistic c3 = s.getExpiredSessionsRemoved();
            final CountStatistic c2 = s.getPassivationErrors();
            final CountStatistic c1 = s.getPassivations();
        }
    }
}
Also used : QueryMgr(com.sun.appserv.management.base.QueryMgr) Set(java.util.Set) BeanCacheMonitor(com.sun.appserv.management.monitor.BeanCacheMonitor) Iterator(java.util.Iterator) BoundedRangeStatistic(org.glassfish.j2ee.statistics.BoundedRangeStatistic) CountStatistic(org.glassfish.j2ee.statistics.CountStatistic) EJBCacheStats(com.sun.appserv.management.monitor.statistics.EJBCacheStats)

Example 2 with BoundedRangeStatistic

use of org.glassfish.j2ee.statistics.BoundedRangeStatistic in project Payara by payara.

the class StatsImpl method statToString.

public String statToString() {
    StringBuffer sbuf = new StringBuffer();
    Statistic[] stats = getStatistics();
    int sz = stats.length;
    for (int i = 0; i < sz; i++) {
        if (stats[i] instanceof CountStatistic) {
            CountStatistic stat = (CountStatistic) stats[i];
            sbuf.append(stat.getName()).append("=").append(stat.getCount()).append("; ");
        } else if (stats[i] instanceof BoundedRangeStatistic) {
            BoundedRangeStatistic stat = (BoundedRangeStatistic) stats[i];
            sbuf.append(stat.getName()).append("=").append(stat.getCurrent()).append("; ");
        } else {
            sbuf.append(stats[i].getName()).append("=?");
        }
    }
    return sbuf.toString();
}
Also used : BoundedRangeStatistic(org.glassfish.j2ee.statistics.BoundedRangeStatistic) CountStatistic(org.glassfish.j2ee.statistics.CountStatistic) Statistic(org.glassfish.j2ee.statistics.Statistic) CountStatistic(org.glassfish.j2ee.statistics.CountStatistic) BoundedRangeStatistic(org.glassfish.j2ee.statistics.BoundedRangeStatistic)

Aggregations

BoundedRangeStatistic (org.glassfish.j2ee.statistics.BoundedRangeStatistic)2 CountStatistic (org.glassfish.j2ee.statistics.CountStatistic)2 QueryMgr (com.sun.appserv.management.base.QueryMgr)1 BeanCacheMonitor (com.sun.appserv.management.monitor.BeanCacheMonitor)1 EJBCacheStats (com.sun.appserv.management.monitor.statistics.EJBCacheStats)1 Iterator (java.util.Iterator)1 Set (java.util.Set)1 Statistic (org.glassfish.j2ee.statistics.Statistic)1