Class ZookeeperUtils

java.lang.Object
org.apache.hadoop.yarn.service.utils.ZookeeperUtils

public class ZookeeperUtils extends Object
  • Field Details

  • Constructor Details

    • ZookeeperUtils

      public ZookeeperUtils()
  • Method Details

    • buildConnectionString

      public static String buildConnectionString(String zkHosts, int port)
    • splitToPairs

      public static List<String> splitToPairs(String hostPortQuorumList)
      Take a quorum list and split it to (trimmed) pairs
      Parameters:
      hostPortQuorumList - list of form h1:port, h2:port2,...
      Returns:
      a possibly empty list of values between commas. They may not be valid hostname:port pairs
    • splitToHostsAndPorts

      public static List<org.apache.hadoop.thirdparty.com.google.common.net.HostAndPort> splitToHostsAndPorts(String hostPortQuorumList)
      Split a quorum list into a list of hostnames and ports
      Parameters:
      hostPortQuorumList - split to a list of hosts and ports
      Returns:
      a list of values
    • buildHostsOnlyList

      public static String buildHostsOnlyList(List<org.apache.hadoop.thirdparty.com.google.common.net.HostAndPort> hostAndPorts)
      Build up to a hosts only list
      Parameters:
      hostAndPorts -
      Returns:
      a list of the hosts only
    • buildQuorumEntry

      public static String buildQuorumEntry(org.apache.hadoop.thirdparty.com.google.common.net.HostAndPort hostAndPort, int defaultPort)
    • buildQuorum

      public static String buildQuorum(List<org.apache.hadoop.thirdparty.com.google.common.net.HostAndPort> hostAndPorts, int defaultPort)
      Build a quorum list, injecting a ":defaultPort" ref if needed on any entry without one
      Parameters:
      hostAndPorts -
      defaultPort -
      Returns:
    • convertToHostsOnlyList

      public static String convertToHostsOnlyList(String quorum) throws BadConfigException
      Throws:
      BadConfigException
    • splitToHostsAndPortsStrictly

      public static List<org.apache.hadoop.thirdparty.com.google.common.net.HostAndPort> splitToHostsAndPortsStrictly(String quorum) throws BadConfigException
      Throws:
      BadConfigException
    • getFirstPort

      public static int getFirstPort(String quorum, int defVal) throws BadConfigException
      Throws:
      BadConfigException