use of com.frameworkset.commons.pool2.impl.GenericObjectPoolConfig in project ksan by infinistor.
the class OSDClientManager method init.
public void init(int port, int osdClientCount) throws Exception {
logger.debug(GWConstants.LOG_OSDCLIENT_MANAGER_CLIENT_COUNT, osdClientCount);
GenericObjectPoolConfig config = new GenericObjectPoolConfig();
config.setMaxTotal(osdClientCount);
for (SERVER server : diskpoolList.getDiskpool().getServers()) {
if (!GWUtils.getLocalIP().equals(server.getIp())) {
logger.debug(GWConstants.LOG_OSDCLIENT_MANAGER_OSD_SERVER_IP, server.getIp());
OSDClientFactory factory = new OSDClientFactory(server.getIp(), port);
OSDClientPool pool = new OSDClientPool(factory, config);
pool.preparePool();
pools.put(server.getIp(), pool);
}
}
}
use of com.frameworkset.commons.pool2.impl.GenericObjectPoolConfig in project jackdking-root by wmsJackWang.
the class JdkObjectResourcePool method getConfig.
public static GenericObjectPoolConfig getConfig() {
GenericObjectPoolConfig config = new GenericObjectPoolConfig();
config.setMinIdle(5);
config.setMaxTotal(5);
config.setMaxWaitMillis(20000);
return config;
}
use of com.frameworkset.commons.pool2.impl.GenericObjectPoolConfig in project springframework-source-5.1.x by wb02125055.
the class CommonsPool2TargetSource method createObjectPool.
/**
* Subclasses can override this if they want to return a specific Commons pool.
* They should apply any configuration properties to the pool here.
* <p>Default is a GenericObjectPool instance with the given pool size.
* @return an empty Commons {@code ObjectPool}.
* @see GenericObjectPool
* @see #setMaxSize
*/
protected ObjectPool createObjectPool() {
GenericObjectPoolConfig config = new GenericObjectPoolConfig();
config.setMaxTotal(getMaxSize());
config.setMaxIdle(getMaxIdle());
config.setMinIdle(getMinIdle());
config.setMaxWaitMillis(getMaxWait());
config.setTimeBetweenEvictionRunsMillis(getTimeBetweenEvictionRunsMillis());
config.setMinEvictableIdleTimeMillis(getMinEvictableIdleTimeMillis());
config.setBlockWhenExhausted(isBlockWhenExhausted());
return new GenericObjectPool(this, config);
}
use of com.frameworkset.commons.pool2.impl.GenericObjectPoolConfig in project hummer-framework by hummer-team.
the class RedisPropertiesBuilder method builderObjectPoolConfig.
public static GenericObjectPoolConfig builderObjectPoolConfig(final String dbGroup) {
GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
JedisPoolConfig config = builderPoolConfig(dbGroup);
poolConfig.setMaxIdle(config.getMaxIdle());
poolConfig.setMaxTotal(config.getMaxTotal());
poolConfig.setMaxWaitMillis(config.getMaxWaitMillis());
return poolConfig;
}
use of com.frameworkset.commons.pool2.impl.GenericObjectPoolConfig in project proctor by indeedeng.
the class SvnObjectPools method createObjectPool.
private static <T> ObjectPool<T> createObjectPool(final PooledObjectFactory<T> factory) {
final GenericObjectPoolConfig objectPoolConfig = new GenericObjectPoolConfig();
// arbitrary, but positive so objects do get evicted
objectPoolConfig.setMinEvictableIdleTimeMillis(TimeUnit.HOURS.toMillis(1));
// arbitrary, but positive so objects do get evicted
objectPoolConfig.setTimeBetweenEvictionRunsMillis(TimeUnit.MINUTES.toMillis(10));
objectPoolConfig.setJmxEnabled(false);
objectPoolConfig.setBlockWhenExhausted(false);
// uncapped number of objects in the pool
objectPoolConfig.setMaxTotal(-1);
final AbandonedConfig abandonedConfig = new AbandonedConfig();
abandonedConfig.setRemoveAbandonedOnBorrow(true);
abandonedConfig.setRemoveAbandonedTimeout((int) TimeUnit.MINUTES.toSeconds(30));
return new GenericObjectPool<T>(factory, objectPoolConfig, abandonedConfig);
}
Aggregations