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.RangeStatistic;
08:
09: public class RangeStatisticImpl extends StatisticImpl implements
10: RangeStatistic {
11: public long getCurrent() {
12: return current;
13: }
14:
15: public void setCurrent(long current) {
16: this .current = current;
17: if (current > highWaterMark) {
18: highWaterMark = current;
19: } else if (current < lowWaterMark) {
20: lowWaterMark = current;
21: }
22:
23: setLastSampleTime(System.currentTimeMillis());
24: }
25:
26: public long getHighWaterMark() {
27: return highWaterMark;
28: }
29:
30: public void setHighWaterMark(long highWaterMark) {
31: this .highWaterMark = highWaterMark;
32: }
33:
34: public long getLowWaterMark() {
35: return lowWaterMark;
36: }
37:
38: public void setLowWaterMark(long lowWaterMark) {
39: this .lowWaterMark = lowWaterMark;
40: }
41:
42: private long current;
43: private long highWaterMark;
44: private long lowWaterMark;
45:
46: public void reset() {
47: current = highWaterMark = lowWaterMark = 0;
48: super.reset();
49: }
50: }
|