KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > web > stats > ServletTimeStatisticImpl


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 package com.sun.enterprise.web.stats;
25
26 import com.sun.enterprise.admin.monitor.stats.TimeStatisticImpl;
27 import com.sun.enterprise.web.monitor.PwcServletStats;
28
29 public class ServletTimeStatisticImpl extends TimeStatisticImpl {
30
31     private PwcServletStats servletStats;
32
33     /**
34      * Constructor.
35      */

36     public ServletTimeStatisticImpl(String JavaDoc name, String JavaDoc unit,
37                                     PwcServletStats servletStats) {
38         super(name, unit);
39         this.servletStats = servletStats;
40     }
41     
42     /**
43      * Returns the number of times an operation was invoked
44      *
45      * @return long indicating the number of invocations
46      */

47     public long getCount() {
48         return servletStats.getRequestCount();
49     }
50     
51     /**
52      * Returns the maximum amount of time that it took for one invocation of an
53      * operation, since measurement started.
54      *
55      * @return long indicating the maximum time for one invocation
56      */

57     public long getMaxTime() {
58         return servletStats.getMaxTimeMillis();
59     }
60     
61     /**
62      * Returns the minimum amount of time that it took for one invocation of an
63      * operation, since measurement started.
64      *
65      * @return long indicating the minimum time for one invocation
66      */

67     public long getMinTime() {
68         return servletStats.getMinTimeMillis();
69     }
70
71     /**
72      * Returns the amount of time that it took for all invocations,
73      * since measurement started.
74      *
75      * @return long indicating the total time for all invocation
76      */

77     public long getTotalTime() {
78         return servletStats.getProcessingTimeMillis();
79     }
80 }
81
82
Popular Tags