Merge branch 'present-close-to-jedis-cluster' of https://github.com/HeartSaVioR/jedis into HeartSaVioR-present-close-to-jedis-cluster
This commit is contained in:
@@ -2,12 +2,13 @@ package redis.clients.jedis;
|
||||
|
||||
import redis.clients.jedis.BinaryClient.LIST_POSITION;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
public class JedisCluster implements JedisCommands, BasicCommands {
|
||||
public class JedisCluster implements JedisCommands, BasicCommands, Closeable {
|
||||
public static final short HASHSLOTS = 16384;
|
||||
private static final int DEFAULT_TIMEOUT = 1;
|
||||
private static final int DEFAULT_MAX_REDIRECTIONS = 5;
|
||||
@@ -32,6 +33,21 @@ public class JedisCluster implements JedisCommands, BasicCommands {
|
||||
this.timeout = timeout;
|
||||
this.maxRedirections = maxRedirections;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
if (connectionHandler != null) {
|
||||
for (JedisPool pool : connectionHandler.getNodes().values()) {
|
||||
try {
|
||||
if (pool != null) {
|
||||
pool.destroy();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String set(final String key, final String value) {
|
||||
|
||||
Reference in New Issue
Block a user