01: /*
02: * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.monitoring.statistics;
06:
07: import javax.management.j2ee.statistics.TimeStatistic;
08:
09: public class TimeStatisticImpl extends CountStatisticImpl implements
10: TimeStatistic {
11: public long getMaxTime() {
12: return maxTime;
13: }
14:
15: public void setMaxTime(long maxTime) {
16: this .maxTime = maxTime;
17: }
18:
19: public long getMinTime() {
20: return minTime;
21: }
22:
23: public void setMinTime(long minTime) {
24: this .minTime = minTime;
25: }
26:
27: public long getTotalTime() {
28: return totalTime;
29: }
30:
31: public void setTotalTime(long totalTime) {
32: this .totalTime = totalTime;
33: }
34:
35: private long maxTime;
36: private long minTime;
37: private long totalTime;
38:
39: public void reset() {
40: maxTime = minTime = totalTime = 0;
41: super .reset();
42: }
43:
44: public void setTime(long currentTime) {
45: count++;
46:
47: if (maxTime < currentTime) {
48: maxTime = currentTime;
49: } else if (minTime > currentTime) {
50: minTime = currentTime;
51: }
52:
53: totalTime += currentTime;
54: }
55: }
|