/** 
 * 
 * Copyright 2004 Protique Ltd
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 * 
 **/
package org.codehaus.activemq.management;

import javax.management.j2ee.statistics.BoundedRangeStatistic;
import javax.management.j2ee.statistics.CountStatistic;
import javax.management.j2ee.statistics.JCAConnectionPoolStats;
import javax.management.j2ee.statistics.RangeStatistic;
import javax.management.j2ee.statistics.TimeStatistic;

/**
 * Statistics for a JCA connection pool
 *
 * @version $Revision: 1.1 $
 */
public class JCAConnectionPoolStatsImpl extends JCAConnectionStatsImpl implements JCAConnectionPoolStats {
    private CountStatistic closeCount;
    private CountStatistic createCount;
    private BoundedRangeStatistic freePoolSize;
    private BoundedRangeStatistic poolSize;
    private RangeStatistic waitingThreadCount;

    public JCAConnectionPoolStatsImpl(String connectionFactory, String managedConnectionFactory, TimeStatistic waitTime, TimeStatistic useTime, CountStatistic closeCount, CountStatistic createCount, BoundedRangeStatistic freePoolSize, BoundedRangeStatistic poolSize, RangeStatistic waitingThreadCount) {
        super(connectionFactory, managedConnectionFactory, waitTime, useTime);
        this.closeCount = closeCount;
        this.createCount = createCount;
        this.freePoolSize = freePoolSize;
        this.poolSize = poolSize;
        this.waitingThreadCount = waitingThreadCount;

        // lets add named stats
        addStatistic("freePoolSize", freePoolSize);
        addStatistic("poolSize", poolSize);
        addStatistic("waitingThreadCount", waitingThreadCount);
    }

    public CountStatistic getCloseCount() {
        return closeCount;
    }

    public CountStatistic getCreateCount() {
        return createCount;
    }

    public BoundedRangeStatistic getFreePoolSize() {
        return freePoolSize;
    }

    public BoundedRangeStatistic getPoolSize() {
        return poolSize;
    }

    public RangeStatistic getWaitingThreadCount() {
        return waitingThreadCount;
    }

}
