use of redis.clients.util.ClusterNodeInformation in project new-cloud by xie-summer.
the class JedisClusterNodeInformationParserTest method testParseNodeMyself.
@Test
public void testParseNodeMyself() {
String nodeInfo = "9b0d2ab38ee31482c95fdb2c7847a0d40e88d518 :7379 myself,master - 0 0 1 connected 0-5460";
HostAndPort current = new HostAndPort("localhost", 7379);
ClusterNodeInformation clusterNodeInfo = parser.parse(nodeInfo, current);
assertEquals(clusterNodeInfo.getNode(), current);
}
use of redis.clients.util.ClusterNodeInformation in project cachecloud by sohutv.
the class JedisClusterNodeInformationParserTest method testParseNodeMyself.
@Test
public void testParseNodeMyself() {
String nodeInfo = "9b0d2ab38ee31482c95fdb2c7847a0d40e88d518 :7379 myself,master - 0 0 1 connected 0-5460";
HostAndPort current = new HostAndPort("localhost", 7379);
ClusterNodeInformation clusterNodeInfo = parser.parse(nodeInfo, current);
assertEquals(clusterNodeInfo.getNode(), current);
}
use of redis.clients.util.ClusterNodeInformation in project cachecloud by sohutv.
the class JedisClusterInfoCache method discoverClusterNodesAndSlots.
public void discoverClusterNodesAndSlots(Jedis jedis) {
w.lock();
try {
this.nodes.clear();
this.slots.clear();
String localNodes = jedis.clusterNodes();
for (String nodeInfo : localNodes.split("\n")) {
ClusterNodeInformation clusterNodeInfo = nodeInfoParser.parse(nodeInfo, new HostAndPort(jedis.getClient().getHost(), jedis.getClient().getPort()));
HostAndPort targetNode = clusterNodeInfo.getNode();
setNodeIfNotExist(targetNode);
assignSlotsToNode(clusterNodeInfo.getAvailableSlots(), targetNode);
}
} finally {
w.unlock();
}
}
Aggregations