@Override public void setMaxWait(long maxWait) { this.pool.setMaxWait(maxWait); } }
private <K, V> GenericKeyedObjectPool<K, V> getObjectPool(KeyedPoolableObjectFactory<K, V> factory, String poolName, long maxWaitMillis) { GenericKeyedObjectPool<K, V> pool = new GenericKeyedObjectPool<>(factory); pool.setTestOnBorrow(true); pool.setMaxActive(-1); pool.setMaxIdle(-1); pool.setTimeBetweenEvictionRunsMillis(MILLISECONDS.convert(5, MINUTES)); pool.setMinEvictableIdleTimeMillis(MILLISECONDS.convert(5, MINUTES)); pool.setMaxWait(maxWaitMillis); pool.setTestOnReturn(true); pool.setTestOnBorrow(true); try { ManagedGenericKeyedObjectPool mbean = new ManagedGenericKeyedObjectPool( pool, poolName); ManagementFactory.getPlatformMBeanServer() .registerMBean(mbean, mbean.getObjectName()); } catch (Exception e) { log.error("Could not register mbean for pool [{}]", poolName, e); } return pool; }
/** * Sets the configuration. * @param conf the new configuration to use. * @see GenericKeyedObjectPool.Config */ public synchronized void setConfig(GenericKeyedObjectPool.Config conf) { setMaxIdle(conf.maxIdle); setMaxActive(conf.maxActive); setMaxTotal(conf.maxTotal); setMinIdle(conf.minIdle); setMaxWait(conf.maxWait); setWhenExhaustedAction(conf.whenExhaustedAction); setTestOnBorrow(conf.testOnBorrow); setTestOnReturn(conf.testOnReturn); setTestWhileIdle(conf.testWhileIdle); setNumTestsPerEvictionRun(conf.numTestsPerEvictionRun); setMinEvictableIdleTimeMillis(conf.minEvictableIdleTimeMillis); setTimeBetweenEvictionRunsMillis(conf.timeBetweenEvictionRunsMillis); }
/** * Allows a maxWait timeout to be configured on the requester object pool See: * {@link GenericKeyedObjectPool#setMaxWait(long)} */ public void setRequesterPoolMaxWait(int maxWait) { requesters.setMaxWait(maxWait); }
/** * @see org.apache.commons.pool.impl.GenericKeyedObjectPool#setMaxWait(long) */ public void setMaxWait(long maxWait) { this.keyedObjectPool.setMaxWait(maxWait); }
/** * @see org.apache.commons.pool.impl.GenericKeyedObjectPool#setMaxWait(long) */ public void setMaxWait(long maxWait) { this.keyedObjectPool.setMaxWait(maxWait); }
/** * Set the maximum amount of time (in milliseconds) to wait for a transport to be returned from the pool. * Set to 0 or less to block indefinitely. */ public void setMaxWait(long maxWait) { transportPool.setMaxWait(maxWait); }
/** * Allows a maxWait timeout to be configured on the requester object pool See: {@link GenericKeyedObjectPool#setMaxWait(long)} */ public void setRequesterPoolMaxWait(int maxWait) { requesters.setMaxWait(maxWait); }
public void setMaxWait(long maxWait) { pool.setMaxWait(maxWait); }
@Override public void setMaxWait(long maxWait) { this.pool.setMaxWait(maxWait); } }
/** * @see org.apache.commons.pool.impl.GenericKeyedObjectPool#setMaxWait(long) */ public void setMaxWait(long maxWait) { this.keyedObjectPool.setMaxWait(maxWait); }
/** * Set the maximum amount of time (in milliseconds) to wait for a transport to be returned from the pool. * Set to 0 or less to block indefinitely. */ public void setMaxWait(long maxWait) { transportPool.setMaxWait(maxWait); }
/** * @see org.apache.commons.pool.impl.GenericKeyedObjectPool#setMaxWait(long) */ public void setMaxWait(long maxWait) { this.keyedObjectPool.setMaxWait(maxWait); }
public void setMaxWait(long maxWait) { pool.setMaxWait(maxWait); }
private <K, V> GenericKeyedObjectPool<K, V> getObjectPool(KeyedPoolableObjectFactory<K, V> factory, String poolName, long maxWaitMillis) { GenericKeyedObjectPool<K, V> pool = new GenericKeyedObjectPool<>(factory); pool.setTestOnBorrow(true); pool.setMaxActive(-1); pool.setMaxIdle(-1); pool.setTimeBetweenEvictionRunsMillis(MILLISECONDS.convert(5, MINUTES)); pool.setMinEvictableIdleTimeMillis(MILLISECONDS.convert(5, MINUTES)); pool.setMaxWait(maxWaitMillis); pool.setTestOnReturn(true); pool.setTestOnBorrow(true); try { ManagedGenericKeyedObjectPool mbean = new ManagedGenericKeyedObjectPool( pool, poolName); ManagementFactory.getPlatformMBeanServer() .registerMBean(mbean, mbean.getObjectName()); } catch (Exception e) { log.error("Could not register mbean for pool [{}]", poolName, e); } return pool; }
public synchronized static void initializeConnectionPool(EventSyncConnectionPoolFactory factory, int maxActive, int maxTotal, int maxIdle, long maxWait, long minEvictableIdleTimeMillis) { if (connectionPool == null) { connectionPool = new GenericKeyedObjectPool(); connectionPool.setFactory(factory); connectionPool.setMaxTotal(maxTotal); connectionPool.setMaxActive(maxActive); connectionPool.setTestOnBorrow(true); connectionPool.setTimeBetweenEvictionRunsMillis(12000); connectionPool.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); connectionPool.setMaxIdle(maxIdle); connectionPool.setMaxWait(maxWait); connectionPool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK); } }
/** * Sets the configuration. * @param conf the new configuration to use. * @see GenericKeyedObjectPool.Config */ public synchronized void setConfig(GenericKeyedObjectPool.Config conf) { setMaxIdle(conf.maxIdle); setMaxActive(conf.maxActive); setMaxTotal(conf.maxTotal); setMinIdle(conf.minIdle); setMaxWait(conf.maxWait); setWhenExhaustedAction(conf.whenExhaustedAction); setTestOnBorrow(conf.testOnBorrow); setTestOnReturn(conf.testOnReturn); setTestWhileIdle(conf.testWhileIdle); setNumTestsPerEvictionRun(conf.numTestsPerEvictionRun); setMinEvictableIdleTimeMillis(conf.minEvictableIdleTimeMillis); setTimeBetweenEvictionRunsMillis(conf.timeBetweenEvictionRunsMillis); }
/** * Sets the configuration. * @param conf the new configuration to use. * @see GenericKeyedObjectPool.Config */ public synchronized void setConfig(GenericKeyedObjectPool.Config conf) { setMaxIdle(conf.maxIdle); setMaxActive(conf.maxActive); setMaxTotal(conf.maxTotal); setMinIdle(conf.minIdle); setMaxWait(conf.maxWait); setWhenExhaustedAction(conf.whenExhaustedAction); setTestOnBorrow(conf.testOnBorrow); setTestOnReturn(conf.testOnReturn); setTestWhileIdle(conf.testWhileIdle); setNumTestsPerEvictionRun(conf.numTestsPerEvictionRun); setMinEvictableIdleTimeMillis(conf.minEvictableIdleTimeMillis); setTimeBetweenEvictionRunsMillis(conf.timeBetweenEvictionRunsMillis); }
/** * Sets the configuration. * @param conf the new configuration to use. * @see GenericKeyedObjectPool.Config */ public synchronized void setConfig(GenericKeyedObjectPool.Config conf) { setMaxIdle(conf.maxIdle); setMaxActive(conf.maxActive); setMaxTotal(conf.maxTotal); setMinIdle(conf.minIdle); setMaxWait(conf.maxWait); setWhenExhaustedAction(conf.whenExhaustedAction); setTestOnBorrow(conf.testOnBorrow); setTestOnReturn(conf.testOnReturn); setTestWhileIdle(conf.testWhileIdle); setNumTestsPerEvictionRun(conf.numTestsPerEvictionRun); setMinEvictableIdleTimeMillis(conf.minEvictableIdleTimeMillis); setTimeBetweenEvictionRunsMillis(conf.timeBetweenEvictionRunsMillis); }
/** * Sets the configuration. * @param conf the new configuration to use. * @see GenericKeyedObjectPool.Config */ public synchronized void setConfig(GenericKeyedObjectPool.Config conf) { setMaxIdle(conf.maxIdle); setMaxActive(conf.maxActive); setMaxTotal(conf.maxTotal); setMinIdle(conf.minIdle); setMaxWait(conf.maxWait); setWhenExhaustedAction(conf.whenExhaustedAction); setTestOnBorrow(conf.testOnBorrow); setTestOnReturn(conf.testOnReturn); setTestWhileIdle(conf.testWhileIdle); setNumTestsPerEvictionRun(conf.numTestsPerEvictionRun); setMinEvictableIdleTimeMillis(conf.minEvictableIdleTimeMillis); setTimeBetweenEvictionRunsMillis(conf.timeBetweenEvictionRunsMillis); }