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();
public void returnConnection(Jedis connection) {
cache.getNode(getNodeKey(connection.getClient()))
.returnResource(connection);
cache.getNode(getNodeKey(connection.getClient())).returnResource(
connection);
}
public void returnBrokenConnection(Jedis connection) {
cache.getNode(getNodeKey(connection.getClient()))
.returnBrokenResource(connection);
cache.getNode(getNodeKey(connection.getClient())).returnBrokenResource(
connection);
}
abstract Jedis getConnectionFromSlot(int slot);

View File

@@ -36,7 +36,8 @@ public class JedisClusterInfoCache {
HostAndPort targetNode = clusterNodeInfo.getNode();
setNodeIfNotExist(targetNode);
assignSlotsToNode(clusterNodeInfo.getAvailableSlots(), targetNode);
assignSlotsToNode(clusterNodeInfo.getAvailableSlots(),
targetNode);
}
} finally {
w.unlock();
@@ -78,8 +79,7 @@ public class JedisClusterInfoCache {
}
private HostAndPort generateHostAndPort(List<Object> hostInfos) {
return new HostAndPort(
SafeEncoder.encode((byte[]) hostInfos.get(0)),
return new HostAndPort(SafeEncoder.encode((byte[]) hostInfos.get(0)),
((Long) hostInfos.get(1)).intValue());
}
@@ -172,9 +172,8 @@ public class JedisClusterInfoCache {
private List<Integer> getAssignedSlotArray(List<Object> slotInfo) {
List<Integer> slotNums = new ArrayList<Integer>();
for (int slot = ((Long) slotInfo.get(0)).intValue();
slot <= ((Long) slotInfo.get(1)).intValue();
slot++) {
for (int slot = ((Long) slotInfo.get(0)).intValue(); slot <= ((Long) slotInfo
.get(1)).intValue(); slot++) {
slotNums.add(slot);
}
return slotNums;