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

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

Introduction

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

Prototype

public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory) 

Source Link

Document

Create a new GenericKeyedObjectPool using the specified values.

Usage

From source file:org.kisst.cordys.as400.conn.As400ConnectionPool.java

public As400ConnectionPool(As400PoolSettings settings, Props props) {
    this.settings = settings;
    this.globalProps = props;
    StdSchedulerFactory factory = new StdSchedulerFactory();
    try {/*  w  w w . ja v a  2  s.c o  m*/
        scheduler = factory.getScheduler();
        scheduler.start();
    } catch (SchedulerException e) {
        throw new RuntimeException(e);
    }
    pool = new GenericKeyedObjectPool(new As400ConnectionFactory(settings, props));
}

From source file:org.scale7.cassandra.pelops.pool.CommonsBackedPool.java

protected void configureBackingPool() {
    pool = new GenericKeyedObjectPool(new ConnectionFactory());
    pool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK);
    pool.setMaxWait(DEFAULT_WAIT_PERIOD);
    pool.setLifo(true);/*from ww w  .j  a  va2 s.  c o m*/
    pool.setMaxActive(policy.getMaxActivePerNode());
    pool.setMinIdle(policy.getMinIdlePerNode());
    pool.setMaxIdle(policy.getMaxIdlePerNode());
    pool.setMaxTotal(policy.getMaxTotal());
    pool.setTimeBetweenEvictionRunsMillis(-1); // we don't want to eviction thread running
    pool.setTestWhileIdle(policy.isTestConnectionsWhileIdle());
}