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

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

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

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;/* w  w w.j  av  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;
    }
}