/** * {@inheritDoc} */ public ObjectPool<T> createPool() { return new GenericObjectPool<T>(_factory,_maxActive,_whenExhaustedAction,_maxWait,_maxIdle,_minIdle,_testOnBorrow,_testOnReturn,_timeBetweenEvictionRunsMillis,_numTestsPerEvictionRun,_minEvictableIdleTimeMillis,_testWhileIdle,_softMinEvictableIdleTimeMillis,_lifo); }
boolean lifo = hdpConfig.getBoolean(CONNECTION_LIFO, GenericObjectPool.DEFAULT_LIFO); GenericObjectPool objectPool = new GenericObjectPool(); objectPool.setMaxActive(maxPoolSize); objectPool.setMaxWait(connectionTimeout);
new DriverManagerConnectionFactory(connectUrl, jdbcProps); connectionPool = new GenericObjectPool();
protected void initPool() { poolConfig = new GenericObjectPool.Config(); poolConfig.minIdle = url.getIntParameter(URLParamType.minClientConnection.getName(), URLParamType.minClientConnection.getIntValue()); poolConfig.maxIdle = url.getIntParameter(URLParamType.maxClientConnection.getName(), URLParamType.maxClientConnection.getIntValue()); poolConfig.maxActive = poolConfig.maxIdle; poolConfig.maxWait = url.getIntParameter(URLParamType.requestTimeout.getName(), URLParamType.requestTimeout.getIntValue()); poolConfig.lifo = url.getBooleanParameter(URLParamType.poolLifo.getName(), URLParamType.poolLifo.getBooleanValue()); poolConfig.minEvictableIdleTimeMillis = defaultMinEvictableIdleTimeMillis; poolConfig.softMinEvictableIdleTimeMillis = defaultSoftMinEvictableIdleTimeMillis; poolConfig.timeBetweenEvictionRunsMillis = defaultTimeBetweenEvictionRunsMillis; factory = createChannelFactory(); pool = new GenericObjectPool(factory, poolConfig); boolean lazyInit = url.getBooleanParameter(URLParamType.lazyInit.getName(), URLParamType.lazyInit.getBooleanValue()); if (!lazyInit) { initConnection(true); } }
public CommonsPoolFactory create(TargetServiceFactory targetServiceFactory, String maxSize) { CommonsPoolFactory commonsPoolFactory = new CommonsPoolFactory(targetServiceFactory, maxSize); GenericObjectPool apachePool = new GenericObjectPool(commonsPoolFactory); CommonsPoolAdapter pool = new CommonsPoolAdapter(apachePool); if (maxSize == null) { Debug.logError("[JdonFramework] not set pool's max size", module); } else { int maxInt = Integer.parseInt(maxSize); pool.setMaxPoolSize(maxInt); } commonsPoolFactory.setPool(pool); return commonsPoolFactory; }
pool = new GenericObjectPool(seConnectionFactory, poolCfg);
if (connectionPool == null) { connectionPool = new GenericObjectPool(
/** * {@inheritDoc} */ public ObjectPool<T> createPool() { return new GenericObjectPool<T>(_factory,_maxActive,_whenExhaustedAction,_maxWait,_maxIdle,_minIdle,_testOnBorrow,_testOnReturn,_timeBetweenEvictionRunsMillis,_numTestsPerEvictionRun,_minEvictableIdleTimeMillis,_testWhileIdle,_softMinEvictableIdleTimeMillis,_lifo); }
/** * {@inheritDoc} */ public ObjectPool<T> createPool() { return new GenericObjectPool<T>(_factory,_maxActive,_whenExhaustedAction,_maxWait,_maxIdle,_minIdle,_testOnBorrow,_testOnReturn,_timeBetweenEvictionRunsMillis,_numTestsPerEvictionRun,_minEvictableIdleTimeMillis,_testWhileIdle,_softMinEvictableIdleTimeMillis,_lifo); }
/** * Creates a new instance of Pool. * * @param poolConfig * @param factory */ public Pool(final GenericObjectPool.Config poolConfig, PoolableObjectFactory factory) { this.internalPool = new GenericObjectPool(factory, poolConfig); }
Properties props = new Properties(); props.put("validationQuery", "SELECT 1 from dual;"); props.put("testWhileIdle","true"); final ObjectPool connectionPool = new GenericObjectPool(null); final ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(connectUri, props); new PoolableConnectionFactory(connectionFactory, connectionPool, null, null, false, true); final PoolingDataSource dataSource = new PoolingDataSource(connectionPool);
public class CommercialObjectFactory extends BasePoolableObjectFactory { // for makeObject we'll simply return a new commercial object @Override public Object makeObject() { return new CommercialObject(); } } GenericObjectPool pool = new GenericObjectPool(new CommercialObjectFactory()); // The size of pool in our case it is N pool.setMaxActive(N) // We want to wait if the pool is exhausted pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK)
/** * ctor */ public FSKVService(CBeanConfiguration cBeanConfiguration) { final String rootFS = System.getProperty("user.dir") + File.separator + "fskvdata" + File.separator + cBeanConfiguration.getClusterName(); logger.info("FSKV data is at '" + rootFS + "'"); fileClientPool = new GenericObjectPool<File>(new FSPoolableObjectFactoryImpl(rootFS), MAX_STORAGESERVICE_CONNECTIONS); }
public void afterPropertiesSet() throws Exception { if (pool == null) { GenericObjectPool goPool = new GenericObjectPool(); goPool.setTestOnBorrow(true); goPool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW); pool = goPool; } pool.setFactory(this); }
public XsltTransformer() { super(); transformerPool = new GenericObjectPool(new PooledXsltTransformerFactory()); transformerPool.setMinIdle(MIN_IDLE_TRANSFORMERS); transformerPool.setMaxIdle(MAX_IDLE_TRANSFORMERS); transformerPool.setMaxActive(MAX_ACTIVE_TRANSFORMERS); contextProperties = new HashMap<String, Object>(); }
private EntitlementServiceStub getEntitlementStub(String serverUrl) throws Exception { if (configurationContext == null) { throw new EntitlementProxyException("Cannot initialize EntitlementServiceStub with null Axis2 " + "configuration context."); } if (serviceStubPool == null) { serviceStubPool = new GenericObjectPool(new EntitlementServiceStubFactory( configurationContext, serverUrl + ENTITLEMENT_SERVICE_NAME, authenticator)); } return (EntitlementServiceStub) serviceStubPool.borrowObject(); }
public DefaultComponentPool(PoolableObjectFactory objectFactory) { pool = new GenericObjectPool(objectFactory); pool.setMinIdle(POOL_SIZE); pool.setMaxActive(POOL_SIZE); pool.setNumTestsPerEvictionRun(0); pool.setMinEvictableIdleTimeMillis(0); pool.setTimeBetweenEvictionRunsMillis(POOL_SPAWN_DELAY); }
private GenericObjectPool<XPathExpression> getXPathExpressionPool(String expression) { GenericObjectPool genericPool = new GenericObjectPool(new XPathExpressionFactory(xpathFactory, expression, namespaceContext, this)); genericPool.setMaxActive(MAX_ACTIVE_XPATH_EXPRESSIONS); genericPool.setMaxIdle(MAX_IDLE_XPATH_EXPRESSIONS); genericPool.setMinIdle(MIN_IDLE_XPATH_EXPRESSIONS); return genericPool; }
private ObjectPool<C> createPool() { GenericObjectPool.Config config = new GenericObjectPool.Config(); config.maxIdle = poolingProfile.getMaxIdle(); config.maxActive = poolingProfile.getMaxActive(); config.maxWait = poolingProfile.getMaxWait(); config.whenExhaustedAction = (byte) poolingProfile.getExhaustedAction(); config.minEvictableIdleTimeMillis = poolingProfile.getMinEvictionMillis(); config.timeBetweenEvictionRunsMillis = poolingProfile.getEvictionCheckIntervalMillis(); GenericObjectPool genericPool = new GenericObjectPool(new ObjectFactoryAdapter(), config); return genericPool; }
public void initialize(RuntimeServices rsvc) { config = new GenericObjectPool.Config(); config.maxActive = rsvc.getInt(Props.MAX_ACTIVE, Props.MAX_ACTIVE_DEFAULT); config.maxIdle = rsvc.getInt(Props.MAX_IDLE, Props.MAX_IDLE_DEFAULT); config.maxWait = rsvc.getInt(Props.MAX_WAIT, Props.MAX_WAIT_DEFAULT); config.timeBetweenEvictionRunsMillis = -1; // -1 to disable evictor thread. pool = new GenericObjectPool(new ParserFactory(rsvc), config); if (rsvc.getLog().isDebugEnabled()) { rsvc.getLog().debug("Created parser pool: " + this); } }