use of com.frameworkset.commons.pool2.impl.GenericObjectPoolConfig in project new-cloud by xie-summer.
the class JedisSentinelPoolTest method checkCloseableConnections.
@Test
public void checkCloseableConnections() throws Exception {
GenericObjectPoolConfig config = new GenericObjectPoolConfig();
JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels, config, 1000, "foobared", 2);
Jedis jedis = pool.getResource();
jedis.auth("foobared");
jedis.set("foo", "bar");
assertEquals("bar", jedis.get("foo"));
jedis.close();
pool.close();
assertTrue(pool.isClosed());
}
use of com.frameworkset.commons.pool2.impl.GenericObjectPoolConfig in project new-cloud by xie-summer.
the class JedisSentinelPoolTest method customClientName.
@Test
public void customClientName() {
GenericObjectPoolConfig config = new GenericObjectPoolConfig();
config.setMaxTotal(1);
config.setBlockWhenExhausted(false);
JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels, config, 1000, "foobared", 0, "my_shiny_client_name");
Jedis jedis = pool.getResource();
try {
assertEquals("my_shiny_client_name", jedis.clientGetname());
} finally {
jedis.close();
pool.destroy();
}
assertTrue(pool.isClosed());
}
use of com.frameworkset.commons.pool2.impl.GenericObjectPoolConfig in project new-cloud by xie-summer.
the class ShardedJedisPoolTest method checkConnections.
@Test
public void checkConnections() {
ShardedJedisPool pool = new ShardedJedisPool(new GenericObjectPoolConfig(), shards);
ShardedJedis jedis = pool.getResource();
jedis.set("foo", "bar");
assertEquals("bar", jedis.get("foo"));
jedis.close();
pool.destroy();
}
use of com.frameworkset.commons.pool2.impl.GenericObjectPoolConfig in project new-cloud by xie-summer.
the class ShardedJedisPoolTest method checkFailedJedisServer.
@Test
public void checkFailedJedisServer() {
ShardedJedisPool pool = new ShardedJedisPool(new GenericObjectPoolConfig(), shards);
ShardedJedis jedis = pool.getResource();
jedis.incr("foo");
jedis.close();
pool.destroy();
}
use of com.frameworkset.commons.pool2.impl.GenericObjectPoolConfig in project new-cloud by xie-summer.
the class ShardedJedisPoolTest method checkCloseableConnections.
@Test
public void checkCloseableConnections() throws Exception {
ShardedJedisPool pool = new ShardedJedisPool(new GenericObjectPoolConfig(), shards);
ShardedJedis jedis = pool.getResource();
jedis.set("foo", "bar");
assertEquals("bar", jedis.get("foo"));
jedis.close();
pool.close();
assertTrue(pool.isClosed());
}
Aggregations