use of io.leopard.redis.RedisConnectionListener in project leopard by tanhaichao.
the class JedisPoolTest method JedisPool.
@Test
public void JedisPool() {
JedisPoolConfig poolConfig = new JedisPoolConfig();
poolConfig.setMaxTotal(1);
String host = "172.17.1.236";
int port = 6311;
int timeout = 3000;
JedisPool pool = new JedisPool(poolConfig, host, port, timeout, null);
{
Jedis jedis = pool.getResource();
pool.returnBrokenResource(jedis);
pool.returnResource(jedis);
}
{
RedisConnectionListener redisConnectionListener = Mockito.mock(RedisConnectionListener.class);
pool.redisConnectionListener = redisConnectionListener;
Jedis jedis = pool.getResource();
pool.returnBrokenResource(jedis);
pool.returnResource(jedis);
}
}
Aggregations