use of redis.clients.jedis.HostAndPort in project incubator-skywalking by apache.
the class JedisClusterConstructorWithHostAndPortArgInterceptor method onConstruct.
@Override
public void onConstruct(EnhancedInstance objInst, Object[] allArguments) {
HostAndPort hostAndPort = (HostAndPort) allArguments[0];
objInst.setSkyWalkingDynamicField(hostAndPort.getHost() + ":" + hostAndPort.getPort());
}
use of redis.clients.jedis.HostAndPort in project incubator-skywalking by apache.
the class JedisClusterConstructorWithListHostAndPortArgInterceptor method onConstruct.
@Override
public void onConstruct(EnhancedInstance objInst, Object[] allArguments) {
StringBuilder redisConnInfo = new StringBuilder();
Set<HostAndPort> hostAndPorts = (Set<HostAndPort>) allArguments[0];
for (HostAndPort hostAndPort : hostAndPorts) {
redisConnInfo.append(hostAndPort.toString()).append(";");
}
objInst.setSkyWalkingDynamicField(redisConnInfo.toString());
}
use of redis.clients.jedis.HostAndPort in project new-cloud by xie-summer.
the class JedisClusterNodeInformationParserTest method testParseNormalState.
@Test
public void testParseNormalState() {
String nodeInfo = "5f4a2236d00008fba7ac0dd24b95762b446767bd 192.168.0.3:7380 master - 0 1400598804016 2 connected 5461-10922";
HostAndPort current = new HostAndPort("localhost", 7379);
ClusterNodeInformation clusterNodeInfo = parser.parse(nodeInfo, current);
assertNotEquals(clusterNodeInfo.getNode(), current);
assertEquals(clusterNodeInfo.getNode(), new HostAndPort("192.168.0.3", 7380));
for (int slot = 5461; slot <= 10922; slot++) {
assertTrue(clusterNodeInfo.getAvailableSlots().contains(slot));
}
assertTrue(clusterNodeInfo.getSlotsBeingImported().isEmpty());
assertTrue(clusterNodeInfo.getSlotsBeingMigrated().isEmpty());
}
use of redis.clients.jedis.HostAndPort in project new-cloud by xie-summer.
the class JedisClusterNodeInformationParserTest method testParseSlotBeingMigrated.
@Test
public void testParseSlotBeingMigrated() {
String nodeInfo = "5f4a2236d00008fba7ac0dd24b95762b446767bd :7379 myself,master - 0 0 1 connected 0-5459 [5460->-5f4a2236d00008fba7ac0dd24b95762b446767bd] [5461-<-5f4a2236d00008fba7ac0dd24b95762b446767bd]";
HostAndPort current = new HostAndPort("localhost", 7379);
ClusterNodeInformation clusterNodeInfo = parser.parse(nodeInfo, current);
assertEquals(clusterNodeInfo.getNode(), current);
for (int slot = 0; slot <= 5459; slot++) {
assertTrue(clusterNodeInfo.getAvailableSlots().contains(slot));
}
assertEquals(1, clusterNodeInfo.getSlotsBeingMigrated().size());
assertTrue(clusterNodeInfo.getSlotsBeingMigrated().contains(5460));
assertEquals(1, clusterNodeInfo.getSlotsBeingImported().size());
assertTrue(clusterNodeInfo.getSlotsBeingImported().contains(5461));
}
use of redis.clients.jedis.HostAndPort in project new-cloud by xie-summer.
the class JedisSentinelPoolTest method initializeWithNotAvailableSentinelsShouldThrowException.
@Test(expected = JedisConnectionException.class)
public void initializeWithNotAvailableSentinelsShouldThrowException() {
Set<String> wrongSentinels = new HashSet<String>();
wrongSentinels.add(new HostAndPort("localhost", 65432).toString());
wrongSentinels.add(new HostAndPort("localhost", 65431).toString());
JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, wrongSentinels);
pool.destroy();
}
Aggregations