objectPool.setNumTestsPerEvictionRun(numTestsPerEvictionRun); objectPool.setTestOnReturn(testOnReturn); objectPool.setSoftMinEvictableIdleTimeMillis(softMinEvictableIdleTimeMillis); objectPool.setLifo(lifo);
/** * Sets my configuration. * * @param conf configuration to use. * @see GenericObjectPool.Config */ public void setConfig(GenericObjectPool.Config conf) { synchronized (this) { setMaxIdle(conf.maxIdle); setMinIdle(conf.minIdle); setMaxActive(conf.maxActive); setMaxWait(conf.maxWait); setWhenExhaustedAction(conf.whenExhaustedAction); setTestOnBorrow(conf.testOnBorrow); setTestOnReturn(conf.testOnReturn); setTestWhileIdle(conf.testWhileIdle); setNumTestsPerEvictionRun(conf.numTestsPerEvictionRun); setMinEvictableIdleTimeMillis(conf.minEvictableIdleTimeMillis); setTimeBetweenEvictionRunsMillis(conf.timeBetweenEvictionRunsMillis); setSoftMinEvictableIdleTimeMillis(conf.softMinEvictableIdleTimeMillis); setLifo(conf.lifo); } allocate(); }
/** * Creates a {@link GenericObjectPool}. Override this method to set custom objectPool configurations. */ protected GenericObjectPool<T> newObjectPool(final ObjectFactory<T> objectFactory) { final int maxActive = Math.max(2, Runtime.getRuntime().availableProcessors()); final GenericObjectPool<T> pool = new GenericObjectPool<T>(new BasePoolableObjectFactory<T>() { @Override public T makeObject() throws Exception { return objectFactory.create(); } }); pool.setMaxActive(maxActive); pool.setMaxIdle(MAX_IDLE); pool.setMaxWait(MAX_WAIT); /** * Use WHEN_EXHAUSTED_GROW strategy, otherwise the pool object retrieval can fail. More details here: * <a>http://code.google.com/p/wro4j/issues/detail?id=364</a> */ pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW); // make object eligible for eviction after a predefined amount of time. pool.setSoftMinEvictableIdleTimeMillis(EVICTABLE_IDLE_TIME); pool.setTimeBetweenEvictionRunsMillis(EVICTABLE_IDLE_TIME); return pool; }
/** * Creates a {@link GenericObjectPool}. Override this method to set custom objectPool configurations. */ protected GenericObjectPool<T> newObjectPool(final ObjectFactory<T> objectFactory) { final int maxActive = Math.max(2, Runtime.getRuntime().availableProcessors()); final GenericObjectPool<T> pool = new GenericObjectPool<T>(new BasePoolableObjectFactory<T>() { @Override public T makeObject() throws Exception { return objectFactory.create(); } }); pool.setMaxActive(maxActive); pool.setMaxIdle(MAX_IDLE); pool.setMaxWait(MAX_WAIT); /** * Use WHEN_EXHAUSTED_GROW strategy, otherwise the pool object retrieval can fail. More details here: * <a>http://code.google.com/p/wro4j/issues/detail?id=364</a> */ pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW); // make object eligible for eviction after a predefined amount of time. pool.setSoftMinEvictableIdleTimeMillis(EVICTABLE_IDLE_TIME); pool.setTimeBetweenEvictionRunsMillis(EVICTABLE_IDLE_TIME); return pool; }
int etime = (_etime == null ? -1 : Integer.parseInt(_etime)); pool.setTimeBetweenEvictionRunsMillis(etime); pool.setSoftMinEvictableIdleTimeMillis(etime);
int etime = (_etime == null ? -1 : Integer.parseInt(_etime)); pool.setTimeBetweenEvictionRunsMillis(etime); pool.setSoftMinEvictableIdleTimeMillis(etime);
/** * Sets my configuration. * * @param conf configuration to use. * @see GenericObjectPool.Config */ public void setConfig(GenericObjectPool.Config conf) { synchronized (this) { setMaxIdle(conf.maxIdle); setMinIdle(conf.minIdle); setMaxActive(conf.maxActive); setMaxWait(conf.maxWait); setWhenExhaustedAction(conf.whenExhaustedAction); setTestOnBorrow(conf.testOnBorrow); setTestOnReturn(conf.testOnReturn); setTestWhileIdle(conf.testWhileIdle); setNumTestsPerEvictionRun(conf.numTestsPerEvictionRun); setMinEvictableIdleTimeMillis(conf.minEvictableIdleTimeMillis); setTimeBetweenEvictionRunsMillis(conf.timeBetweenEvictionRunsMillis); setSoftMinEvictableIdleTimeMillis(conf.softMinEvictableIdleTimeMillis); setLifo(conf.lifo); } allocate(); }
/** * Sets my configuration. * * @param conf configuration to use. * @see GenericObjectPool.Config */ public synchronized void setConfig(GenericObjectPool.Config conf) { setMaxIdle(conf.maxIdle); setMinIdle(conf.minIdle); setMaxActive(conf.maxActive); setMaxWait(conf.maxWait); setWhenExhaustedAction(conf.whenExhaustedAction); setTestOnBorrow(conf.testOnBorrow); setTestOnReturn(conf.testOnReturn); setTestWhileIdle(conf.testWhileIdle); setNumTestsPerEvictionRun(conf.numTestsPerEvictionRun); setMinEvictableIdleTimeMillis(conf.minEvictableIdleTimeMillis); setTimeBetweenEvictionRunsMillis(conf.timeBetweenEvictionRunsMillis); setSoftMinEvictableIdleTimeMillis(conf.softMinEvictableIdleTimeMillis); setLifo(conf.lifo); allocate(); }
/** * Sets my configuration. * * @param conf configuration to use. * @see GenericObjectPool.Config */ public synchronized void setConfig(GenericObjectPool.Config conf) { setMaxIdle(conf.maxIdle); setMinIdle(conf.minIdle); setMaxActive(conf.maxActive); setMaxWait(conf.maxWait); setWhenExhaustedAction(conf.whenExhaustedAction); setTestOnBorrow(conf.testOnBorrow); setTestOnReturn(conf.testOnReturn); setTestWhileIdle(conf.testWhileIdle); setNumTestsPerEvictionRun(conf.numTestsPerEvictionRun); setMinEvictableIdleTimeMillis(conf.minEvictableIdleTimeMillis); setTimeBetweenEvictionRunsMillis(conf.timeBetweenEvictionRunsMillis); setSoftMinEvictableIdleTimeMillis(conf.softMinEvictableIdleTimeMillis); setLifo(conf.lifo); allocate(); }
/** * Sets my configuration. * * @param conf configuration to use. * @see GenericObjectPool.Config */ public void setConfig(GenericObjectPool.Config conf) { synchronized (this) { setMaxIdle(conf.maxIdle); setMinIdle(conf.minIdle); setMaxActive(conf.maxActive); setMaxWait(conf.maxWait); setWhenExhaustedAction(conf.whenExhaustedAction); setTestOnBorrow(conf.testOnBorrow); setTestOnReturn(conf.testOnReturn); setTestWhileIdle(conf.testWhileIdle); setNumTestsPerEvictionRun(conf.numTestsPerEvictionRun); setMinEvictableIdleTimeMillis(conf.minEvictableIdleTimeMillis); setTimeBetweenEvictionRunsMillis(conf.timeBetweenEvictionRunsMillis); setSoftMinEvictableIdleTimeMillis(conf.softMinEvictableIdleTimeMillis); setLifo(conf.lifo); } allocate(); }
this.connectionPool.setMinEvictableIdleTimeMillis ( getLong ( paramProperties, PREFIX + "minEvictableIdleTimeMillis", 30 * 60 * 1000 ) ); this.connectionPool.setTestWhileIdle ( getBoolean ( paramProperties, PREFIX + "testWhileIdle", false ) ); this.connectionPool.setSoftMinEvictableIdleTimeMillis ( getLong ( paramProperties, PREFIX + "softMinEvictableIdleTimeMillis", -1 ) ); this.connectionPool.setNumTestsPerEvictionRun ( getInteger ( paramProperties, PREFIX + "numTestsPerEvictionRun", 3 ) );
this.connectionPool.setMinEvictableIdleTimeMillis ( getLong ( paramProperties, PREFIX + "minEvictableIdleTimeMillis", 30 * 60 * 1000 ) ); this.connectionPool.setTestWhileIdle ( getBoolean ( paramProperties, PREFIX + "testWhileIdle", false ) ); this.connectionPool.setSoftMinEvictableIdleTimeMillis ( getLong ( paramProperties, PREFIX + "softMinEvictableIdleTimeMillis", -1 ) ); this.connectionPool.setNumTestsPerEvictionRun ( getInteger ( paramProperties, PREFIX + "numTestsPerEvictionRun", 3 ) );
protected void configureGenericObjectPool(GenericObjectPool genericObjectPool) throws SyslogRuntimeException { SyslogPoolConfigIF poolConfig = null; try { poolConfig = (SyslogPoolConfigIF) this.syslog.getConfig(); } catch (ClassCastException cce) { throw new SyslogRuntimeException("config must implement interface SyslogPoolConfigIF"); } genericObjectPool.setMaxActive(poolConfig.getMaxActive()); genericObjectPool.setMaxIdle(poolConfig.getMaxIdle()); genericObjectPool.setMaxWait(poolConfig.getMaxWait()); genericObjectPool.setMinEvictableIdleTimeMillis(poolConfig.getMinEvictableIdleTimeMillis()); genericObjectPool.setMinIdle(poolConfig.getMinIdle()); genericObjectPool.setNumTestsPerEvictionRun(poolConfig.getNumTestsPerEvictionRun()); genericObjectPool.setSoftMinEvictableIdleTimeMillis(poolConfig.getSoftMinEvictableIdleTimeMillis()); genericObjectPool.setTestOnBorrow(poolConfig.isTestOnBorrow()); genericObjectPool.setTestOnReturn(poolConfig.isTestOnReturn()); genericObjectPool.setTestWhileIdle(poolConfig.isTestWhileIdle()); genericObjectPool.setTimeBetweenEvictionRunsMillis(poolConfig.getTimeBetweenEvictionRunsMillis()); genericObjectPool.setWhenExhaustedAction(poolConfig.getWhenExhaustedAction()); }
protected void configureGenericObjectPool(GenericObjectPool<AbstractSyslogWriter> genericObjectPool) throws SyslogRuntimeException { SyslogPoolConfigIF poolConfig = null; try { poolConfig = (SyslogPoolConfigIF) this.syslog.getConfig(); } catch (ClassCastException cce) { throw new SyslogRuntimeException("config must implement interface SyslogPoolConfigIF"); } genericObjectPool.setMaxActive(poolConfig.getMaxActive()); genericObjectPool.setMaxIdle(poolConfig.getMaxIdle()); genericObjectPool.setMaxWait(poolConfig.getMaxWait()); genericObjectPool.setMinEvictableIdleTimeMillis(poolConfig.getMinEvictableIdleTimeMillis()); genericObjectPool.setMinIdle(poolConfig.getMinIdle()); genericObjectPool.setNumTestsPerEvictionRun(poolConfig.getNumTestsPerEvictionRun()); genericObjectPool.setSoftMinEvictableIdleTimeMillis(poolConfig.getSoftMinEvictableIdleTimeMillis()); genericObjectPool.setTestOnBorrow(poolConfig.isTestOnBorrow()); genericObjectPool.setTestOnReturn(poolConfig.isTestOnReturn()); genericObjectPool.setTestWhileIdle(poolConfig.isTestWhileIdle()); genericObjectPool.setTimeBetweenEvictionRunsMillis(poolConfig.getTimeBetweenEvictionRunsMillis()); genericObjectPool.setWhenExhaustedAction(poolConfig.getWhenExhaustedAction()); }