KickJava   Java API By Example, From Geeks To Geeks.

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


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: MutableStatistic.java,v 1.2 2005/12/25 03:52:19 tcfujii Exp $
31  * $Date: 2005/12/25 03:52:19 $
32  * $Revision: 1.2 $
33  */

34
35
36 package com.sun.enterprise.admin.monitor.stats;
37 import javax.management.j2ee.statistics.Statistic JavaDoc;
38 import java.io.Serializable JavaDoc;
39
40 /** An interface that gives a flexibility to set various values for a particular Statistic.
41  * This provision is basically to have the same data structure to collect and
42  * return the (read-only copy of) statistical data. This extends the
43  * java.io.Serializable, so that its subclasses can be serialized to facilitate
44  * working with other management clients.
45  * Refer to the package description
46  * to understand the intent of this interface.
47  * <P>
48  * Methods of this class should be called judiciously by the component that is
49  * gathering the statistics.
50  * @author Kedar Mhaswade
51  * @since S1AS8.0
52  * @version 1.0
53  */

54
55 public interface MutableStatistic extends Serializable JavaDoc {
56
57     /**
58      * Returns a read-only view of this Statistic. An implementing class has
59      * to return the instances of Statistic interfaces defined in {@link javax.management.j2ee.statistic}
60      * and {@link com.sun.enterprise.admin.monitor.stats} packages.
61      * @return an instance of a specific Statistic interface
62      */

63     public Statistic JavaDoc unmodifiableView();
64
65     /**
66      * Returns an instance of Statistic whose state can be changed by the caller. It is important
67      * to know that caller should not cache the return value from this method. In general, there
68      * is a problem in this contract in that, a client would not know from a Stats.getCreateCount()
69      * method whether the return value is something that is being modified or is invariant. Hence
70      * the caller should not cache the returned value in a collection and then collectively
71      * process it. The main idea behind providing this method is to control the
72      * number of instances created (per Mahesh's Suggestion).
73      * @return an instance of Statistic interface that should not be cached.
74      */

75     public Statistic JavaDoc modifiableView();
76     
77     /**
78      * Resets the encapsulated Statistic interface to its initial value. The idea being, if (after
79      * creation of the instance) the state changes, the initial state can be easily regained by
80      * calling this method. Note that the time of last sampling changes to the instant
81      * when this method is invoked.
82      */

83     public void reset();
84 }
85
Popular Tags