Class ZookeeperUtils
java.lang.Object
org.apache.hadoop.yarn.service.utils.ZookeeperUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildConnectionString(String zkHosts, int port) static StringbuildHostsOnlyList(List<org.apache.hadoop.thirdparty.com.google.common.net.HostAndPort> hostAndPorts) Build up to a hosts only liststatic StringbuildQuorum(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 onestatic StringbuildQuorumEntry(org.apache.hadoop.thirdparty.com.google.common.net.HostAndPort hostAndPort, int defaultPort) static StringconvertToHostsOnlyList(String quorum) static intgetFirstPort(String quorum, int defVal) static List<org.apache.hadoop.thirdparty.com.google.common.net.HostAndPort>splitToHostsAndPorts(String hostPortQuorumList) Split a quorum list into a list of hostnames and portsstatic List<org.apache.hadoop.thirdparty.com.google.common.net.HostAndPort>splitToHostsAndPortsStrictly(String quorum) splitToPairs(String hostPortQuorumList) Take a quorum list and split it to (trimmed) pairs
-
Field Details
-
DEFAULT_PORT
public static final int DEFAULT_PORT- See Also:
-
-
Constructor Details
-
ZookeeperUtils
public ZookeeperUtils()
-
-
Method Details
-
buildConnectionString
-
splitToPairs
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
- Throws:
BadConfigException
-
splitToHostsAndPortsStrictly
public static List<org.apache.hadoop.thirdparty.com.google.common.net.HostAndPort> splitToHostsAndPortsStrictly(String quorum) throws BadConfigException - Throws:
BadConfigException
-
getFirstPort
- Throws:
BadConfigException
-