Package redis.clients.jedis

Examples of redis.clients.jedis.ShardedJedisPool.destroy()


    new GenericObjectPoolConfig(), shards);
  ShardedJedis jedis = pool.getResource();
  jedis.set("foo", "bar");
  assertEquals("bar", jedis.get("foo"));
  pool.returnResource(jedis);
  pool.destroy();
    }

    @Test
    public void checkCloseableConnections() throws Exception {
  ShardedJedisPool pool = new ShardedJedisPool(
View Full Code Here


    new GenericObjectPoolConfig(), shards);
  ShardedJedis jedis = pool.getResource();
  jedis.set("foo", "bar");
  assertEquals("bar", jedis.get("foo"));
  pool.returnResource(jedis);
  pool.destroy();
    }

    @Test
    public void checkJedisIsReusedWhenReturned() {
  ShardedJedisPool pool = new ShardedJedisPool(
View Full Code Here

  pool.returnResource(jedis);

  jedis = pool.getResource();
  jedis.incr("foo");
  pool.returnResource(jedis);
  pool.destroy();
    }

    @Test
    public void checkPoolRepairedWhenJedisIsBroken() {
  ShardedJedisPool pool = new ShardedJedisPool(
View Full Code Here

  pool.returnBrokenResource(jedis);

  jedis = pool.getResource();
  jedis.incr("foo");
  pool.returnResource(jedis);
  pool.destroy();
    }

    @Test(expected = JedisConnectionException.class)
    public void checkPoolOverflow() {
  GenericObjectPoolConfig config = new GenericObjectPoolConfig();
View Full Code Here

  ShardedJedisPool pool = new ShardedJedisPool(
    new GenericObjectPoolConfig(), shards);
  ShardedJedis jedis = pool.getResource();
  jedis.incr("foo");
  pool.returnResource(jedis);
  pool.destroy();
    }

    @Test
    public void shouldReturnActiveShardsWhenOneGoesOffline() {
  GenericObjectPoolConfig redisConfig = new GenericObjectPoolConfig();
View Full Code Here

  Long c2 = j.dbSize();
  j.disconnect();
  // shutdown shard 2 and check thay the pool returns an instance with c1
  // items on one shard
  // alter shard 1 and recreate pool
  pool.destroy();
  shards.set(1, new JedisShardInfo("localhost", 1234));
  pool = new ShardedJedisPool(redisConfig, shards);
  jedis = pool.getResource();
  Long actual = Long.valueOf(0);
  Long fails = Long.valueOf(0);
View Full Code Here

      } catch (RuntimeException e) {
    fails++;
      }
  }
  pool.returnResource(jedis);
  pool.destroy();
  assertEquals(actual, c1);
  assertEquals(fails, c2);
    }

    @Test
View Full Code Here

  pipeline.incr("pipelined2");
  List<Object> results = pipeline.syncAndReturnAll();

  assertEquals(2, results.size());
  pool.returnResource(jedis);
  pool.destroy();
    }

    @Test
    public void checkResourceIsCloseable() throws URISyntaxException {
  GenericObjectPoolConfig config = new GenericObjectPoolConfig();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.