01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.management.stats;
17:
18: import javax.management.j2ee.statistics.BoundedRangeStatistic;
19:
20: /**
21: * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
22: */
23: public class BoundedRangeStatisticImpl extends RangeStatisticImpl
24: implements BoundedRangeStatistic {
25: private long upperBound;
26: private long lowerBound;
27:
28: public BoundedRangeStatisticImpl(String name, String unit,
29: String description) {
30: super (name, unit, description);
31: }
32:
33: public BoundedRangeStatisticImpl(String name, String unit,
34: String description, long currentValue, long lowerBound,
35: long upperBound) {
36: super (name, unit, description, currentValue);
37: this .upperBound = upperBound;
38: this .lowerBound = lowerBound;
39: }
40:
41: public long getUpperBound() {
42: return upperBound;
43: }
44:
45: public void setUpperBound(long upperBound) {
46: this .upperBound = upperBound;
47: }
48:
49: public long getLowerBound() {
50: return lowerBound;
51: }
52:
53: public void setLowerBound(long lowerBound) {
54: this .lowerBound = lowerBound;
55: }
56:
57: public void setBounds(long lower, long upper) {
58: upperBound = upper;
59: lowerBound = lower;
60: }
61:
62: public void setCurrent(long current) {
63: super .setCurrent(current);
64: if (current < lowerBound) {
65: lowerBound = current;
66: }
67: if (current > upperBound) {
68: upperBound = current;
69: }
70: }
71:
72: public String toString() {
73: return (getName() + " in " + getUnit() + " -- lowerBound: "
74: + lowerBound + ", upperBound: " + ", current: "
75: + getCurrent() + ", highWaterMark: "
76: + getHighWaterMark() + ", lowWaterMark: " + getLowWaterMark());
77: }
78: }
|