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 package org.apache.geronimo.management.stats;
018
019 import javax.management.j2ee.statistics.BoundedRangeStatistic;
020 import javax.management.j2ee.statistics.CountStatistic;
021 import javax.management.j2ee.statistics.JCAConnectionPoolStats;
022 import javax.management.j2ee.statistics.RangeStatistic;
023
024 /**
025 * Geronimo implementation of the JSR-77 JCAConnectionPoolStats interface.
026 *
027 * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
028 */
029 public class JCAConnectionPoolStatsImpl extends JCAConnectionStatsImpl
030 implements JCAConnectionPoolStats {
031 private final CountStatisticImpl closeCount;
032
033 private final CountStatisticImpl createCount;
034
035 private final BoundedRangeStatisticImpl freePoolSize;
036
037 private final BoundedRangeStatisticImpl poolSize;
038
039 private final RangeStatisticImpl waitingThreadCount;
040
041 public JCAConnectionPoolStatsImpl() {
042 closeCount = new CountStatisticImpl("Close Count",
043 StatisticImpl.UNIT_COUNT, "Number of connections closed");
044 createCount = new CountStatisticImpl("Create Count",
045 StatisticImpl.UNIT_COUNT, "Number of connections created");
046 freePoolSize = new BoundedRangeStatisticImpl("Free Pool Size",
047 StatisticImpl.UNIT_COUNT,
048 "Number of free connections in the pool");
049 poolSize = new BoundedRangeStatisticImpl("Pool Size",
050 StatisticImpl.UNIT_COUNT, "Size of the connection pool");
051 waitingThreadCount = new RangeStatisticImpl("Waiting Thread Count",
052 StatisticImpl.UNIT_COUNT,
053 "Number of threads waiting for a connection");
054
055 addStat("CloseCount", closeCount);
056 addStat("CreateCount", createCount);
057 addStat("FreePoolSize", freePoolSize);
058 addStat("PoolSize", poolSize);
059 addStat("WaitingThreadCount", waitingThreadCount);
060 }
061
062 public CountStatistic getCloseCount() {
063 return closeCount;
064 }
065
066 public CountStatistic getCreateCount() {
067 return createCount;
068 }
069
070 public BoundedRangeStatistic getFreePoolSize() {
071 return freePoolSize;
072 }
073
074 public BoundedRangeStatistic getPoolSize() {
075 return poolSize;
076 }
077
078 public RangeStatistic getWaitingThreadCount() {
079 return waitingThreadCount;
080 }
081 }