Example usage for org.apache.commons.pool.impl GenericObjectPoolFactory GenericObjectPoolFactory

List of usage examples for org.apache.commons.pool.impl GenericObjectPoolFactory GenericObjectPoolFactory

Introduction

In this page you can find the example usage for org.apache.commons.pool.impl GenericObjectPoolFactory GenericObjectPoolFactory.

Prototype

public GenericObjectPoolFactory(PoolableObjectFactory factory, int maxActive, byte whenExhaustedAction,
        long maxWait, int maxIdle) 

Source Link

Document

Create a new GenericObjectPoolFactory.

Usage

From source file:org.yosemite.jcsadra.impl.SimpleCassandraClientPool.java

/**
 * this construct method wamaxWaitWhenBlockExhausteds for unit test, for regulary usage, should not given the client factory 
 *//* w  ww .ja  v a  2s  .c o  m*/
protected SimpleCassandraClientPool(String serviceURL, int port, PoolableObjectFactory clientfactory,
        int maxActive, ExhaustedAction exhaustedAction, long maxWait, int maxIdle) {
    this.serviceURL = serviceURL;
    this.port = port;
    this.maxActive = maxActive;
    this.exhaustedAction = exhaustedAction;
    this.maxWaitWhenBlockByExhausted = maxWait;
    this.maxIdle = maxIdle;

    // if not give  a client factory, will create the default PoolableClientFactory
    if (clientfactory == null) {
        this._clientfactory = new PoolableClientFactory();
        _poolfactory = new GenericObjectPoolFactory(_clientfactory, maxActive,
                getObjectPoolExhaustedAction(exhaustedAction), maxWait, maxIdle);
    } else {
        _poolfactory = new GenericObjectPoolFactory(clientfactory, maxActive,
                getObjectPoolExhaustedAction(exhaustedAction), maxWait, maxIdle);
    }

    _pool = (GenericObjectPool) _poolfactory.createPool();
}