Search in sources :

Example 1 with RedisConnectionListener

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);
    }
}
Also used : Jedis(redis.clients.jedis.Jedis) RedisConnectionListener(io.leopard.redis.RedisConnectionListener) JedisPool(io.leopard.redis.JedisPool) JedisPoolConfig(redis.clients.jedis.JedisPoolConfig) Test(org.junit.Test)

Aggregations

JedisPool (io.leopard.redis.JedisPool)1 RedisConnectionListener (io.leopard.redis.RedisConnectionListener)1 Test (org.junit.Test)1 Jedis (redis.clients.jedis.Jedis)1 JedisPoolConfig (redis.clients.jedis.JedisPoolConfig)1