KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > jetty6 > JettyWebContainerStatsImpl


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * 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  */

17 package org.apache.geronimo.jetty6;
18
19 import javax.management.j2ee.statistics.CountStatistic JavaDoc;
20 import javax.management.j2ee.statistics.RangeStatistic JavaDoc;
21 import javax.management.j2ee.statistics.TimeStatistic JavaDoc;
22
23 import org.apache.geronimo.management.stats.CountStatisticImpl;
24 import org.apache.geronimo.management.stats.RangeStatisticImpl;
25 import org.apache.geronimo.management.stats.StatisticImpl;
26 import org.apache.geronimo.management.stats.StatsImpl;
27 import org.apache.geronimo.management.stats.TimeStatisticImpl;
28
29 /**
30  * Jetty implementation of the Geronimo stats interface WebContainerStats
31  *
32  * @version $Revision: 1.0$
33  */

34 public class JettyWebContainerStatsImpl extends StatsImpl implements JettyWebContainerStats {
35     private CountStatisticImpl totalConnectionCount;
36     private RangeStatisticImpl openConnectionCount;
37     private RangeStatisticImpl connectionRequestCount;
38     private TimeStatisticImpl connectionDuration;
39     private CountStatisticImpl totalErrorCount;
40     private CountStatisticImpl totalRequestCount;
41     private RangeStatisticImpl activeRequestCount;
42     private TimeStatisticImpl requestDuration;
43     private boolean statsOn=false;
44
45     public JettyWebContainerStatsImpl() {
46         totalConnectionCount = new CountStatisticImpl("Total Connections", StatisticImpl.UNIT_COUNT,
47                 "The total number of connections since last reset");
48         openConnectionCount = new RangeStatisticImpl("Open Connections", StatisticImpl.UNIT_COUNT,
49                 "The number of connections open at present");
50         connectionRequestCount = new RangeStatisticImpl("Connection Request Count", StatisticImpl.UNIT_COUNT,
51                 "The number of requests handled by a particular connection");
52         connectionDuration = new TimeStatisticImpl("Connection Duration", StatisticImpl.UNIT_TIME_MILLISECOND,
53                 "The legnth of time that individual connections have been open");
54         totalErrorCount = new CountStatisticImpl("Error Count", StatisticImpl.UNIT_COUNT,
55                 "The number of reponses that were errors since statistics gathering started");
56         totalRequestCount = new CountStatisticImpl("Request Count", StatisticImpl.UNIT_COUNT,
57                 "The number of requests that were handled since statistics gathering started");
58         activeRequestCount = new RangeStatisticImpl("Active Request Count", StatisticImpl.UNIT_COUNT,
59                 "The number of requests being processed concurrently");
60         requestDuration = new TimeStatisticImpl("Request Duration", StatisticImpl.UNIT_TIME_MILLISECOND,
61                 "The length of time that it's taken to handle individual requests");
62
63         addStat("TotalConnectionCount", totalConnectionCount);
64         addStat("OpenConnectionCount", openConnectionCount);
65         addStat("ConnectionRequestCount", connectionRequestCount);
66         addStat("ConnectionDuration", connectionDuration);
67         addStat("TotalErrorCount", totalErrorCount);
68         addStat("TotalRequestCount", totalRequestCount);
69         addStat("ActiveRequestCount", activeRequestCount);
70         addStat("RequestDuration", requestDuration);
71     }
72
73     public CountStatistic JavaDoc getTotalConnectionCount() {
74         return totalConnectionCount;
75     }
76
77     public RangeStatistic JavaDoc getOpenConnectionCount() {
78         return openConnectionCount;
79     }
80
81     public RangeStatistic JavaDoc getConnectionRequestCount() {
82         return connectionRequestCount;
83     }
84
85     public TimeStatistic JavaDoc getConnectionDuration() {
86         return connectionDuration;
87     }
88
89     public CountStatistic JavaDoc getTotalErrorCount() {
90         return totalErrorCount;
91     }
92
93     public CountStatistic JavaDoc getTotalRequestCount() {
94         return totalRequestCount;
95     }
96
97     public RangeStatistic JavaDoc getActiveRequestCount() {
98         return activeRequestCount;
99     }
100
101     public TimeStatistic JavaDoc getRequestDuration() {
102         return requestDuration;
103     }
104
105     public boolean isStatsOn() {
106         return statsOn;
107     }
108
109     public void setStatsOn(boolean on) {
110         statsOn = on;
111     }
112
113     public CountStatisticImpl getTotalConnectionCountImpl() {
114         return totalConnectionCount;
115     }
116
117     public RangeStatisticImpl getOpenConnectionCountImpl() {
118         return openConnectionCount;
119     }
120
121     public RangeStatisticImpl getConnectionRequestCountImpl() {
122         return connectionRequestCount;
123     }
124
125     public TimeStatisticImpl getConnectionDurationImpl() {
126         return connectionDuration;
127     }
128
129     public CountStatisticImpl getTotalErrorCountImpl() {
130         return totalErrorCount;
131     }
132
133     public CountStatisticImpl getTotalRequestCountImpl() {
134         return totalRequestCount;
135     }
136
137     public RangeStatisticImpl getActiveRequestCountImpl() {
138         return activeRequestCount;
139     }
140
141     public TimeStatisticImpl getRequestDurationImpl() {
142         return requestDuration;
143     }
144 }
145
Popular Tags