List of usage examples for org.apache.commons.pool.impl GenericObjectPoolFactory createPool
public ObjectPool createPool()
From source file:com.yahoo.sql4d.sql4ddriver.sql.MysqlAccessor.java
private void init() { GenericObjectPool.Config config = new GenericObjectPool.Config(); config.maxActive = 2;//TODO: Make this configurable. config.testOnBorrow = true;/*from w w w.j ava 2s .c o m*/ config.testWhileIdle = true; config.timeBetweenEvictionRunsMillis = 10000; config.minEvictableIdleTimeMillis = 60000; GenericObjectPoolFactory genericObjectPoolFactory = new GenericObjectPoolFactory(this, config); pool = genericObjectPoolFactory.createPool(); }
From source file:com.yahoo.sql4d.indexeragent.sql.DBAccessor.java
private void initPool() { GenericObjectPool.Config config = new GenericObjectPool.Config(); config.maxActive = 2;//TODO: Make this configurable. config.testOnBorrow = true;//from w w w. j ava 2 s .co m config.testWhileIdle = true; config.timeBetweenEvictionRunsMillis = 10000; config.minEvictableIdleTimeMillis = 60000; GenericObjectPoolFactory genericObjectPoolFactory = new GenericObjectPoolFactory(this, config); pool = genericObjectPoolFactory.createPool(); }
From source file:org.mobicents.slee.container.profile.ProfileObjectPoolManagement.java
/** * //from w w w .j a v a 2 s . co m * @param profileTable */ private void createObjectPool(final ProfileTableImpl profileTable) { // create the pool GenericObjectPoolFactory poolFactory = new GenericObjectPoolFactory( new ProfileObjectPoolFactory(profileTable), config); final ObjectPool objectPool = poolFactory.createPool(); final ProfileObjectPool oldObjectPool = pools.put(profileTable.getProfileTableName(), new ProfileObjectPool(objectPool)); if (oldObjectPool != null) { // there was an old pool, close it try { oldObjectPool.close(); } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Failed to close old pool for " + profileTable); } } } if (logger.isDebugEnabled()) { logger.debug("Created Pool for " + profileTable); } }
From source file:org.mobicents.slee.runtime.sbb.SbbObjectPoolManagementImpl.java
/** * //ww w . j a v a2s .c o m * @param serviceID * @param sbbID */ private void createObjectPool(final ServiceID serviceID, final SbbComponent sbbComponent) { // create the pool for the given SbbID GenericObjectPoolFactory poolFactory = new GenericObjectPoolFactory( new SbbObjectPoolFactory(serviceID, sbbComponent), config); final ObjectPool objectPool = poolFactory.createPool(); final SbbObjectPoolImpl oldObjectPool = pools.put(new ObjectPoolMapKey(serviceID, sbbComponent.getSbbID()), new SbbObjectPoolImpl(sbbComponent, serviceID, objectPool)); if (oldObjectPool != null) { // there was an old pool, close it try { oldObjectPool.close(); } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Failed to close old pool for " + serviceID + "and " + sbbComponent); } } } if (logger.isDebugEnabled()) { logger.debug("Created Pool for " + serviceID + "and " + sbbComponent); } }