Remove unused & buggy method / class (related to ThreadLocal<Random>)
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
package redis.clients.jedis;
|
||||
|
||||
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
||||
import redis.clients.jedis.exceptions.JedisConnectionException;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import static redis.clients.jedis.JedisClusterInfoCache.getNodeKey;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
||||
|
||||
import redis.clients.jedis.exceptions.JedisConnectionException;
|
||||
|
||||
public abstract class JedisClusterConnectionHandler {
|
||||
protected final JedisClusterInfoCache cache;
|
||||
private ThreadLocal<Random> random = new ThreadLocal<Random>();
|
||||
|
||||
abstract Jedis getConnection();
|
||||
|
||||
@@ -29,7 +28,6 @@ public abstract class JedisClusterConnectionHandler {
|
||||
|
||||
public JedisClusterConnectionHandler(Set<HostAndPort> nodes, final GenericObjectPoolConfig poolConfig) {
|
||||
this.cache = new JedisClusterInfoCache(poolConfig);
|
||||
this.random.set(new Random());
|
||||
initializeSlotsCache(nodes, poolConfig);
|
||||
}
|
||||
|
||||
@@ -80,9 +78,4 @@ public abstract class JedisClusterConnectionHandler {
|
||||
}
|
||||
}
|
||||
|
||||
protected JedisPool getRandomConnection() {
|
||||
Object[] nodeArray = cache.getNodes().values().toArray();
|
||||
return (JedisPool) (nodeArray[this.random.get().nextInt(nodeArray.length)]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package redis.clients.jedis;
|
||||
|
||||
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class JedisRandomConnectionHandler extends JedisClusterConnectionHandler {
|
||||
|
||||
public JedisRandomConnectionHandler(Set<HostAndPort> nodes) {
|
||||
super(nodes, new GenericObjectPoolConfig());
|
||||
}
|
||||
|
||||
public JedisRandomConnectionHandler(Set<HostAndPort> nodes,
|
||||
final GenericObjectPoolConfig poolConfig) {
|
||||
super(nodes, poolConfig);
|
||||
}
|
||||
|
||||
public Jedis getConnection() {
|
||||
return getRandomConnection().getResource();
|
||||
}
|
||||
|
||||
@Override
|
||||
Jedis getConnectionFromSlot(int slot) {
|
||||
return getRandomConnection().getResource();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user