Search in sources :

Example 6 with Stats

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

the class MonitorTest method checkAllStats.

public void checkAllStats(final ObjectName objectName) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException {
    trace("checkAllStats: " + objectName);
    final MonitoringStats mon = getProxyFactory().getProxy(objectName, MonitoringStats.class);
    final Method[] methods = mon.getClass().getMethods();
    final Method specificStatsMethod = getSpecificStatsGetterMethod(mon);
    // the type of Stats returned from getStats() should be the same as the type
    // returned from the (only) specific getAbcStats()
    final Stats plainStats = mon.getStats();
    assert (specificStatsMethod.getReturnType().isAssignableFrom(plainStats.getClass())) : "Stats returned from " + objectName + " getStats() should be assignable to " + specificStatsMethod.getReturnType().getName();
    checkStats(mon, plainStats);
    Stats stats = null;
    try {
        // verify that we can get it
        stats = (Stats) specificStatsMethod.invoke(mon, (Object[]) null);
    } catch (Exception e) {
        final Throwable rootCause = ExceptionUtil.getRootCause(e);
        failure("Failure calling " + specificStatsMethod.getName() + "() on " + objectName + " = " + rootCause.getClass().getName());
    }
    assert (plainStats.getClass() == stats.getClass());
    checkStats(mon, stats);
}
Also used : Stats(org.glassfish.j2ee.statistics.Stats) MonitoringStats(com.sun.appserv.management.monitor.MonitoringStats) Method(java.lang.reflect.Method) MonitoringStats(com.sun.appserv.management.monitor.MonitoringStats) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 7 with Stats

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

the class MonitorTest method checkNumStatistics.

public void checkNumStatistics(final MonitoringStats mon) {
    final Stats stats = mon.getStats();
    assert (stats != null) : "null Stats from: " + Util.getObjectName(mon);
    final String[] allNames = mon.getStatisticNames();
    final Statistic[] statistics = mon.getStatistics(allNames);
    assert (statistics.length == allNames.length) : "wrong number of statistics from: " + Util.getObjectName(mon) + ", got " + statistics.length + ", should be " + allNames.length;
}
Also used : CountStatistic(org.glassfish.j2ee.statistics.CountStatistic) BoundaryStatistic(org.glassfish.j2ee.statistics.BoundaryStatistic) Statistic(org.glassfish.j2ee.statistics.Statistic) TimeStatistic(org.glassfish.j2ee.statistics.TimeStatistic) BoundedRangeStatistic(org.glassfish.j2ee.statistics.BoundedRangeStatistic) StringStatistic(com.sun.appserv.management.j2ee.statistics.StringStatistic) RangeStatistic(org.glassfish.j2ee.statistics.RangeStatistic) Stats(org.glassfish.j2ee.statistics.Stats) MonitoringStats(com.sun.appserv.management.monitor.MonitoringStats)

Aggregations

MonitoringStats (com.sun.appserv.management.monitor.MonitoringStats)7 Stats (org.glassfish.j2ee.statistics.Stats)7 StringStatistic (com.sun.appserv.management.j2ee.statistics.StringStatistic)4 BoundaryStatistic (org.glassfish.j2ee.statistics.BoundaryStatistic)4 BoundedRangeStatistic (org.glassfish.j2ee.statistics.BoundedRangeStatistic)4 CountStatistic (org.glassfish.j2ee.statistics.CountStatistic)4 RangeStatistic (org.glassfish.j2ee.statistics.RangeStatistic)4 Statistic (org.glassfish.j2ee.statistics.Statistic)4 TimeStatistic (org.glassfish.j2ee.statistics.TimeStatistic)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Method (java.lang.reflect.Method)2 ObjectName (javax.management.ObjectName)2 CompositeData (javax.management.openmbean.CompositeData)1 CompositeDataSupport (javax.management.openmbean.CompositeDataSupport)1