List of usage examples for org.apache.commons.pool2.impl GenericObjectPoolConfig GenericObjectPoolConfig
GenericObjectPoolConfig
From source file:com.github.andrepnh.jedis.utils.blocks.CommandBlockTest.java
@BeforeClass public static void setupPool() { POOL = new JedisPool(new GenericObjectPoolConfig(), Protocol.DEFAULT_HOST, Protocol.DEFAULT_PORT, Protocol.DEFAULT_TIMEOUT, null, 5); }
From source file:com.reversemind.hypergate.client.ClientPool.java
private static GenericObjectPoolConfig createConfig(int poolSize) { GenericObjectPoolConfig genericObjectPoolConfig = new GenericObjectPoolConfig(); genericObjectPoolConfig.setJmxEnabled(true); genericObjectPoolConfig.setJmxNameBase("HyperGatePool"); genericObjectPoolConfig.setJmxNamePrefix("HyperGatePoolPrefix"); genericObjectPoolConfig.setBlockWhenExhausted(false); genericObjectPoolConfig.setMinIdle(0); genericObjectPoolConfig.setTestOnBorrow(true); genericObjectPoolConfig.setMaxWaitMillis(500); START_POOL_SIZE = poolSize;/*from w w w . jav a 2s. c o m*/ genericObjectPoolConfig.setMaxTotal(START_POOL_SIZE); genericObjectPoolConfig.setMaxIdle(START_POOL_SIZE); return genericObjectPoolConfig; }
From source file:com.gxl.test.shark.resource.redisSetData.java
public @BeforeClass static void init() { GenericObjectPoolConfig cfg = new GenericObjectPoolConfig(); cfg.setMaxIdle(10);/*from w w w .ja v a 2s.c o m*/ cfg.setMinIdle(1); cfg.setMaxIdle(5); cfg.setMaxWaitMillis(5000); cfg.setTestOnBorrow(true); cfg.setTestOnReturn(true); Set<HostAndPort> hostAndPorts = new HashSet<HostAndPort>(); HostAndPort hostAndPort = new HostAndPort("120.24.75.22", 7000); hostAndPorts.add(hostAndPort); jedis = new JedisCluster(hostAndPorts, cfg); }
From source file:me.smoe.adar.pool.commonpool.CommonPool.java
private static GenericObjectPoolConfig buildPoolConfig(int corePoolSize, int maxPoolSize, int keepAliveTime) { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxIdle(corePoolSize);/*from w w w .j a va2 s. c o m*/ config.setMaxTotal(maxPoolSize); config.setMaxWaitMillis(keepAliveTime); return config; }
From source file:com.mycompany.amfclient.ConnectionPool.java
private ConnectionPool() { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxTotal(200);//from w ww . j ava2 s. co m this.connectionPool = new GenericObjectPool(ConnectionPooledFactory.inst(), config); }
From source file:com.dempe.lamp.client.ChannelPool.java
public ChannelPool(CommonClient rpcClient) { objectFactory = new ChannelPoolObjectFactory(rpcClient); GenericObjectPoolConfig config = new GenericObjectPoolConfig(); pool = new GenericObjectPool<Connection>(objectFactory, config); }
From source file:io.lettuce.core.support.GenericConnectionPoolBenchmark.java
@Setup public void setup() { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMinIdle(0);//from w ww . java 2s . c o m config.setMaxIdle(20); config.setMaxTotal(20); pool = ConnectionPoolSupport.createGenericObjectPool( () -> new EmptyStatefulRedisConnection(EmptyRedisChannelWriter.INSTANCE), config); }
From source file:com.zxy.commons.pool.objectpool.TestPool.java
/** * @param factory */ public TestPool() { super(new TestFactory(), new GenericObjectPoolConfig()); }
From source file:com.github.chrishantha.microbenchmark.objectpool.CommonsPool2GenericObjectPoolBenchmark.java
@Override public void setupObjectPool() { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxTotal(poolSize);//from w w w. j a v a2 s. c o m objectPool = new GenericObjectPool<>(new BasePooledObjectFactory<TestObject>() { @Override public TestObject create() throws Exception { return new TestObject(true); } @Override public PooledObject<TestObject> wrap(TestObject testObject) { return new DefaultPooledObject<>(testObject); } }, config); }
From source file:com.skynetcomputing.database.Database.java
/** * Creates a new database connection pool so that statements and queries can be executed. *//*from w w w . j a v a2s .com*/ @SuppressWarnings("unchecked") private Database() { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxIdle(5); config.setMaxTotal(10); // Configurable connectionstring. String connString = MiscUtils.getPropertyOrDefault("dbConnection", URL); String connUser = MiscUtils.getPropertyOrDefault("dbUser", USERNAME); String connPassword = MiscUtils.getPropertyOrDefault("dbPassword", PASSWORD); pool = new GenericObjectPool<>(new BasePooledObjectFactory() { @Override public Object create() throws Exception { return DriverManager.getConnection(connString, connUser, connPassword); } @Override public PooledObject wrap(Object o) { return new PooledSoftReference<>(new SoftReference<>(o)); } }, config); }