Examples of HostAndPort


Examples of redis.clients.jedis.HostAndPort

    private void waitForJedisSentinelPoolRecognizeNewMaster(
      JedisSentinelPool pool, HostAndPort newMaster)
      throws InterruptedException {

  while (true) {
      HostAndPort currentHostMaster = pool.getCurrentHostMaster();

      if (newMaster.equals(currentHostMaster))
    break;

      System.out
View Full Code Here

Examples of redis.clients.jedis.HostAndPort

    commandJedis.sentinelFailover(masterName);
      }
  }, "*");

  String[] chunks = newmaster.get().split(" ");
  HostAndPort newMaster = new HostAndPort(chunks[3],
    Integer.parseInt(chunks[4]));

  return newMaster;
    }
View Full Code Here

Examples of redis.clients.jedis.HostAndPort

    }

    @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);
    }
View Full Code Here

Examples of redis.clients.jedis.HostAndPort

    }

    @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));
  }
View Full Code Here

Examples of redis.clients.jedis.HostAndPort

    }

    @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++) {
View Full Code Here

Examples of redis.clients.jedis.HostAndPort

    public static final int HOST_AND_PORT_INDEX = 1;

    public ClusterNodeInformation parse(String nodeInfo, HostAndPort current) {
  String[] nodeInfoPartArray = nodeInfo.split(" ");

  HostAndPort node = getHostAndPortFromNodeLine(nodeInfoPartArray,
    current);
  ClusterNodeInformation info = new ClusterNodeInformation(node);

  if (nodeInfoPartArray.length >= SLOT_INFORMATIONS_START_INDEX) {
      String[] slotInfoPartArray = extractSlotParts(nodeInfoPartArray);
View Full Code Here

Examples of redis.clients.jedis.HostAndPort

    public HostAndPort getHostAndPortFromNodeLine(String[] nodeInfoPartArray,
      HostAndPort current) {
  String stringHostAndPort = nodeInfoPartArray[HOST_AND_PORT_INDEX];

  String[] arrayHostAndPort = stringHostAndPort.split(":");
  return new HostAndPort(
    arrayHostAndPort[0].isEmpty() ? current.getHost()
      : arrayHostAndPort[0],
    arrayHostAndPort[1].isEmpty() ? current.getPort() : Integer
      .valueOf(arrayHostAndPort[1]));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.