KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > monitor > stats > RangeStatisticImpl


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.
26  * Use is subject to license terms.
27  */

28
29 /*
30  * $Id: RangeStatisticImpl.java,v 1.2 2005/12/25 03:52:24 tcfujii Exp $
31  * $Date: 2005/12/25 03:52:24 $
32  * $Revision: 1.2 $
33  */

34
35 package com.sun.enterprise.admin.monitor.stats;
36 import javax.management.j2ee.statistics.RangeStatistic JavaDoc;
37
38 /** An implementation of a RangeStatistic. All instances of this class are
39  * immutable. Provides all the necessary accessors for properties.
40  * @author Muralidhar Vempaty
41  * @author Kedar Mhaswade
42  * @since S1AS8.0
43  * @verison 1.0
44  */

45
46 public final class RangeStatisticImpl extends StatisticImpl implements RangeStatistic JavaDoc {
47     
48     private final long currentVal;
49     private final long highWaterMark;
50     private final long lowWaterMark;
51     
52     /** Constructs an immutable instance of RangeStatistic.
53      * @param curVal The current value of this statistic
54      * @param highMark The highest value of this statistic, since measurement
55      * started
56      * @param lowMark The lowest value of this statistic, since measurement
57      * started
58      * @param name The name of the statistic
59      * @param unit The unit of measurement for this statistic
60      * @param desc A brief description of the statistic
61      * @param startTime Time in milliseconds at which the measurement was started
62      * @param sampleTime Time at which the last measurement was done.
63      */

64     public RangeStatisticImpl(long curVal, long highMark, long lowMark,
65                               String JavaDoc name, String JavaDoc unit, String JavaDoc desc,
66                               long startTime, long sampleTime) {
67         
68         super(name, unit, desc, startTime, sampleTime);
69         currentVal = curVal;
70         highWaterMark = highMark;
71         lowWaterMark = lowMark;
72     }
73     
74     /**
75      * Returns the current value of this statistic.
76      * @return long indicating the current value
77      */

78     public long getCurrent() {
79         return currentVal;
80     }
81     
82     /**
83      * Returns the highest value of this statistic, since measurement started.
84      * @return long indicating high water mark
85      */

86     public long getHighWaterMark() {
87         return highWaterMark;
88     }
89     
90     /**
91      * Returns the lowest value of this statistic, since measurement started.
92      * @return long indicating low water mark
93      */

94     public long getLowWaterMark() {
95         return lowWaterMark;
96     }
97 }
98
Popular Tags