private static void extractDeadServersFromZNodeString(String deadServerListStr,
    List<ServerName> result) {
    if (deadServerListStr == null || result == null || deadServerListStr.isEmpty()) {
      return;
    }

    // valid server name delimiter "-" has to be after "," in a server name
    int seenCommaCnt = 0;
    int startIndex = 0;
    int len = deadServerListStr.length();

    for (int i = 0; i < len; i++) {
      switch (deadServerListStr.charAt(i)) {
        case ',':
          seenCommaCnt += 1;
          break;
        case '-':
          if (seenCommaCnt >= 2) {
            if (i > startIndex) {
              String serverName = deadServerListStr.substring(startIndex, i);
              if (ServerName.isFullServerName(serverName)) {
                result.add(ServerName.valueOf(serverName));
              } else {
                LOG.error("Found invalid server name:" + serverName);
              }
              startIndex = i + 1;
            }
            seenCommaCnt = 0;
          }
          break;
        default:
          break;
      }
    }

    // add tail
    if (startIndex < len - 1) {
      String serverName = deadServerListStr.substring(startIndex, len);
      if (ServerName.isFullServerName(serverName)) {
        result.add(ServerName.valueOf(serverName));
      } else {
        LOG.error("Found invalid server name at the end:" + serverName);
      }
    }

    LOG.debug("Found dead servers:" + result);
  }
Parse dead server names from queue id. servername can contain "-" such as
"ip-10-46-221-101.ec2.internal", so we need skip some "-" during parsing for the following
cases: 2-ip-10-46-221-101.ec2.internal,52170,1364333181125-&lt;server name>-...
hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ReplicationQueueInfo.java