156157158159160161162163164165166
} pool.returnResource(jedis); // check quantity for each shard Jedis j = new Jedis(shards.get(0)); j.connect(); Long c1 = j.dbSize(); j.disconnect(); j = new Jedis(shards.get(1)); j.connect(); Long c2 = j.dbSize(); j.disconnect();
160161162163164165166167168169170
j.connect(); Long c1 = j.dbSize(); j.disconnect(); j = new Jedis(shards.get(1)); j.connect(); 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();
2021222324252627282930
public class JedisTest extends JedisCommandTestBase { @Test public void useWithoutConnecting() { Jedis jedis = new Jedis("localhost"); jedis.auth("foobared"); jedis.dbSize(); } @Test public void checkBinaryData() { byte[] bigdata = new byte[1777];
465466467468469470471472473474475
public int getSize() throws IOException { Jedis jedis = null; Boolean error = true; try { jedis = acquireConnection(); int size = jedis.dbSize().intValue(); error = false; return size; } finally { if (jedis != null) { returnConnection(jedis, error);