Example usage for javax.management.j2ee.statistics Statistic getName

List of usage examples for javax.management.j2ee.statistics Statistic getName

Introduction

In this page you can find the example usage for javax.management.j2ee.statistics Statistic getName.

Prototype

String getName();

Source Link

Document

The name of this Statistic.

Usage

From source file:org.hyperic.hq.plugin.websphere.WebsphereCollector.java

private double getStatCount(Statistic stat) {
    if (stat instanceof CountStatistic) {
        return ((CountStatistic) stat).getCount();
    } else if (stat instanceof RangeStatistic) {
        return ((RangeStatistic) stat).getCurrent();
    } else if (stat instanceof TimeStatistic) {
        // get the average time (same as MxUtil)
        double value;
        long count = ((TimeStatistic) stat).getCount();
        if (count == 0) {
            value = 0;/*from   w  ww . jav  a 2  s  .c o m*/
        } else {
            value = ((TimeStatistic) stat).getTotalTime() / count;
        }
        return value;
    } else {
        log.error("Unsupported stat type: " + stat.getName() + "/" + stat.getClass().getName());
        return MetricValue.VALUE_NONE;
    }
}