Add a pool for sharded jedis

This commit is contained in:
Jonathan Leibiusky
2010-11-10 13:41:41 -03:00
parent 08f8432215
commit f62548931c
6 changed files with 382 additions and 184 deletions

View File

@@ -31,14 +31,11 @@ public class ShardedJedis extends Sharded<Jedis, JedisShardInfo> implements
public void disconnect() throws IOException {
for (JedisShardInfo jedis : getAllShards()) {
jedis.getResource().quit();
jedis.getResource().disconnect();
}
}
protected Jedis create(JedisShardInfo shard) {
return new Jedis(shard);
}
public String set(String key, String value) {
Jedis j = getShard(key);
return j.set(key, value);