JCAConnectionPoolStatsImpl xref

View Javadoc

    1   /***
    2    *
    3    * Copyright 2004 Protique Ltd
    4    *
    5    * Licensed under the Apache License, Version 2.0 (the "License");
    6    * you may not use this file except in compliance with the License.
    7    * 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   **/
    18  package org.codehaus.activemq.management;
    19
    20  import javax.management.j2ee.statistics.BoundedRangeStatistic;
    21  import javax.management.j2ee.statistics.CountStatistic;
    22  import javax.management.j2ee.statistics.JCAConnectionPoolStats;
    23  import javax.management.j2ee.statistics.RangeStatistic;
    24  import javax.management.j2ee.statistics.TimeStatistic;
    25
    26  /***
    27   * Statistics for a JCA connection pool
    28   *
    29   * @version $Revision: 1.2 $
    30   */
    31  public class JCAConnectionPoolStatsImpl extends JCAConnectionStatsImpl implements JCAConnectionPoolStats {
    32      private CountStatistic closeCount;
    33      private CountStatistic createCount;
    34      private BoundedRangeStatistic freePoolSize;
    35      private BoundedRangeStatistic poolSize;
    36      private RangeStatistic waitingThreadCount;
    37
    38      public JCAConnectionPoolStatsImpl(String connectionFactory, String managedConnectionFactory, TimeStatistic waitTime, TimeStatistic useTime, CountStatistic closeCount, CountStatistic createCount, BoundedRangeStatistic freePoolSize, BoundedRangeStatistic poolSize, RangeStatistic waitingThreadCount) {
    39          super(connectionFactory, managedConnectionFactory, waitTime, useTime);
    40          this.closeCount = closeCount;
    41          this.createCount = createCount;
    42          this.freePoolSize = freePoolSize;
    43          this.poolSize = poolSize;
    44          this.waitingThreadCount = waitingThreadCount;
    45
    46          // lets add named stats
    47          addStatistic("freePoolSize", freePoolSize);
    48          addStatistic("poolSize", poolSize);
    49          addStatistic("waitingThreadCount", waitingThreadCount);
    50      }
    51
    52      public CountStatistic getCloseCount() {
    53          return closeCount;
    54      }
    55
    56      public CountStatistic getCreateCount() {
    57          return createCount;
    58      }
    59
    60      public BoundedRangeStatistic getFreePoolSize() {
    61          return freePoolSize;
    62      }
    63
    64      public BoundedRangeStatistic getPoolSize() {
    65          return poolSize;
    66      }
    67
    68      public RangeStatistic getWaitingThreadCount() {
    69          return waitingThreadCount;
    70      }
    71
    72  }