Re-format source to respect Jedis convention
This commit is contained in:
@@ -14,13 +14,13 @@ public abstract class JedisClusterConnectionHandler {
|
|||||||
abstract Jedis getConnection();
|
abstract Jedis getConnection();
|
||||||
|
|
||||||
public void returnConnection(Jedis connection) {
|
public void returnConnection(Jedis connection) {
|
||||||
cache.getNode(getNodeKey(connection.getClient()))
|
cache.getNode(getNodeKey(connection.getClient())).returnResource(
|
||||||
.returnResource(connection);
|
connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void returnBrokenConnection(Jedis connection) {
|
public void returnBrokenConnection(Jedis connection) {
|
||||||
cache.getNode(getNodeKey(connection.getClient()))
|
cache.getNode(getNodeKey(connection.getClient())).returnBrokenResource(
|
||||||
.returnBrokenResource(connection);
|
connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract Jedis getConnectionFromSlot(int slot);
|
abstract Jedis getConnectionFromSlot(int slot);
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ public class JedisClusterInfoCache {
|
|||||||
|
|
||||||
HostAndPort targetNode = clusterNodeInfo.getNode();
|
HostAndPort targetNode = clusterNodeInfo.getNode();
|
||||||
setNodeIfNotExist(targetNode);
|
setNodeIfNotExist(targetNode);
|
||||||
assignSlotsToNode(clusterNodeInfo.getAvailableSlots(), targetNode);
|
assignSlotsToNode(clusterNodeInfo.getAvailableSlots(),
|
||||||
|
targetNode);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
w.unlock();
|
w.unlock();
|
||||||
@@ -78,8 +79,7 @@ public class JedisClusterInfoCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private HostAndPort generateHostAndPort(List<Object> hostInfos) {
|
private HostAndPort generateHostAndPort(List<Object> hostInfos) {
|
||||||
return new HostAndPort(
|
return new HostAndPort(SafeEncoder.encode((byte[]) hostInfos.get(0)),
|
||||||
SafeEncoder.encode((byte[]) hostInfos.get(0)),
|
|
||||||
((Long) hostInfos.get(1)).intValue());
|
((Long) hostInfos.get(1)).intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,9 +172,8 @@ public class JedisClusterInfoCache {
|
|||||||
|
|
||||||
private List<Integer> getAssignedSlotArray(List<Object> slotInfo) {
|
private List<Integer> getAssignedSlotArray(List<Object> slotInfo) {
|
||||||
List<Integer> slotNums = new ArrayList<Integer>();
|
List<Integer> slotNums = new ArrayList<Integer>();
|
||||||
for (int slot = ((Long) slotInfo.get(0)).intValue();
|
for (int slot = ((Long) slotInfo.get(0)).intValue(); slot <= ((Long) slotInfo
|
||||||
slot <= ((Long) slotInfo.get(1)).intValue();
|
.get(1)).intValue(); slot++) {
|
||||||
slot++) {
|
|
||||||
slotNums.add(slot);
|
slotNums.add(slot);
|
||||||
}
|
}
|
||||||
return slotNums;
|
return slotNums;
|
||||||
|
|||||||
Reference in New Issue
Block a user