Search in sources :

Example 1 with PoolableObjectFactory

use of org.apache.commons.pool.PoolableObjectFactory in project Solbase by Photobucket.

the class SolbaseHTablePool2 method getTable.

public HTableInterface getTable(String tableName) {
    GenericObjectPool pool = this.tablePools.get(tableName);
    if (pool == null) {
        // lazy initialization of pool
        PoolableObjectFactory factory = new SolbaseHTableInterfaceFactory(config, tableName);
        pool = new GenericObjectPool(factory, this.maxActive);
    }
    try {
        HTableInterface table = (HTableInterface) pool.borrowObject();
        return table;
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}
Also used : GenericObjectPool(org.apache.commons.pool.impl.GenericObjectPool) PoolableObjectFactory(org.apache.commons.pool.PoolableObjectFactory)

Aggregations

PoolableObjectFactory (org.apache.commons.pool.PoolableObjectFactory)1 GenericObjectPool (org.apache.commons.pool.impl.GenericObjectPool)1