Re-format source to respect Jedis convention

This commit is contained in:
Jungtaek Lim
2014-07-02 23:52:42 +09:00
parent 4b72a4d254
commit 15ab934945
3 changed files with 138 additions and 139 deletions

View File

@@ -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);

View File

@@ -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;