use of org.glassfish.j2ee.statistics.Statistic 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;
}
use of org.glassfish.j2ee.statistics.Statistic in project Payara by payara.
the class StatisticTest method checkOpenDataConversion.
private void checkOpenDataConversion(final Statistic s) throws OpenDataException {
final CompositeData d = J2EEUtil.statisticToCompositeData(s);
final Statistic roundTrip = StatisticFactory.create(d);
assert (s.equals(roundTrip)) : "Conversion to CompositeData and back to Statistic failed:\n" + toString(s) + " != " + toString(roundTrip);
}
use of org.glassfish.j2ee.statistics.Statistic 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();
}
Aggregations