001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 package org.apache.geronimo.management.stats;
019
020 import javax.management.j2ee.statistics.RangeStatistic;
021
022 import org.apache.geronimo.management.geronimo.stats.WebConnectorStats;
023
024 /**
025 * Geronimo implementation of the JSR-77 style WebConnectorStats interface. This
026 * is not required by JSR-77, but provides useful statistics. This will be
027 * discovered by mejb using 'stats' attribute.
028 *
029 * @version $Revision: 706640 $ $Date: 2008-10-21 14:44:05 +0000 (Tue, 21 Oct 2008) $
030 */
031
032 public class WebConnectorStatsImpl extends StatsImpl implements WebConnectorStats {
033 // these come from ThreadPool
034 private RangeStatisticImpl openConnectionCount;
035
036 public WebConnectorStatsImpl() {
037 openConnectionCount = new RangeStatisticImpl("" + "Open Connections", StatisticImpl.UNIT_COUNT,
038 "Range for connections opened during the observed period", 0); // all 0's
039 addStat("OpenConnectionCount", openConnectionCount);
040 }
041
042
043 public RangeStatistic getOpenConnectionCount() {
044 return openConnectionCount;
045 }
046
047 public void setOpenConnection(long current, long highMark, long lowMark) {
048 openConnectionCount.setCurrent(current);
049 openConnectionCount.setHighWaterMark(highMark);
050 openConnectionCount.setLowWaterMark(lowMark);
051 }
052
053 /**
054 * Used to access the native implementation in order to call setters
055 * TODO implement these if needed by console
056 */
057 public RangeStatisticImpl getOpenConnectionCountImpl() {
058 return openConnectionCount;
059 }
060 }