Double result;
for (EmsBean mBean : mBeans) {
mBean.refreshAttributes();
if (metricName.equals(METRIC_MIN_SERVLET_TIME)) {
EmsAttribute att = mBean.getAttribute("minTime");
Long l = (Long) att.getValue();
if (l < min)
min = l;
} else if (metricName.equals(METRIC_MAX_SERVLET_TIME)) {
EmsAttribute att = mBean.getAttribute("maxTime");
Long l = (Long) att.getValue();
if (l > max)
max = l;
} else if (metricName.equals(METRIC_AVG_SERVLET_TIME)) {
EmsAttribute att = mBean.getAttribute("processingTime");
Long l = (Long) att.getValue();
processingTime += l;
att = mBean.getAttribute("requestCount");
Integer i = (Integer) att.getValue();
requestCount += i;
} else if (metricName.equals(METRIC_NUM_SERVLET_REQUESTS)) {
EmsAttribute att = mBean.getAttribute("requestCount");
Integer i = (Integer) att.getValue();
requestCount += i;
} else if (metricName.equals(METRIC_NUM_SERVLET_ERRORS)) {
EmsAttribute att = mBean.getAttribute("errorCount");
Integer i = (Integer) att.getValue();
errorCount += i;
} else if (metricName.equals(METRIC_TOTAL_TIME)) {
EmsAttribute att = mBean.getAttribute("processingTime");
Long l = (Long) att.getValue();
processingTime += l;
}
}
if (metricName.equals(METRIC_AVG_SERVLET_TIME)) {
result = (requestCount > 0) ? ((double) processingTime / (double) requestCount) : Double.NaN;