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.RangeStatistic;
19:
20: import org.apache.geronimo.management.geronimo.stats.WebConnectorStats;
21:
22: /**
23: * Geronimo implementation of the JSR-77 style WebConnectorStats interface. This
24: * is not required by JSR-77, but provides useful statistics. This will be
25: * discovered by mejb using 'stats' attribute.
26: *
27: * @version $Revision: 581936 $ $Date: 2007-10-04 07:46:56 -0700 (Thu, 04 Oct 2007) $
28: */
29:
30: public class WebConnectorStatsImpl extends StatsImpl implements
31: WebConnectorStats {
32: // these come from ThreadPool
33: private RangeStatisticImpl openConnectionCount;
34:
35: public WebConnectorStatsImpl() {
36: openConnectionCount = new RangeStatisticImpl(
37: "" + "Open Connections",
38: StatisticImpl.UNIT_COUNT,
39: "Range for connections opened during the observed period",
40: 0); // all 0's
41: addStat("OpenConnectionCount", openConnectionCount);
42: }
43:
44: public RangeStatistic getOpenConnectionCount() {
45: return openConnectionCount;
46: }
47:
48: public void setOpenConnection(long current, long highMark,
49: long lowMark) {
50: openConnectionCount.setCurrent(current);
51: openConnectionCount.setHighWaterMark(highMark);
52: openConnectionCount.setLowWaterMark(lowMark);
53: }
54:
55: /**
56: * Used to access the native implementation in order to call setters
57: * TODO implement these if needed by console
58: */
59: public RangeStatisticImpl getOpenConnectionCountImpl() {
60: return openConnectionCount;
61: }
62: }
|