private static List<String> getServerHosts(final JdbcConnectionParams connParams,
      final CuratorFramework zooKeeperClient) throws ZooKeeperHiveClientException {
    final String zookeeperNamespace = getZooKeeperNamespace(connParams);
    final String zkPath = ZKPaths.makePath(null, zookeeperNamespace);
    try {
      final List<String> serverHosts = zooKeeperClient.getChildren().forPath(zkPath);
      LOG.info("Discovered HiveServer2 hosts in ZooKeeper [{}]: {}", zkPath, serverHosts);

      if (serverHosts.isEmpty()) {
        LOG.warn("Did not find any HiveServer2 hosts in ZooKeeper [{}]. "
            + "Check that the Hive ZooKeeper namespace is configured correctly.", zkPath);
      }

      // Remove the znodes we've already tried from this list
      serverHosts.removeAll(connParams.getRejectedHostZnodePaths());

      LOG.debug("Servers in ZooKeeper after removing rejected: {}", serverHosts);

      return serverHosts;
    } catch (Exception e) {
      throw new ZooKeeperHiveClientException("Unable to retrive HS2 host information from ZooKeeper", e);
    }
  }
Get a list of all HiveServer2 server hosts.

@param connParams The current JDBC connection parameters
@param zooKeeperClient The client to use to connect to ZooKeeper
@return A list of HiveServer2 hosts
@throws ZooKeeperHiveClientException Failed to communicate to ZooKeeper
jdbc/src/java/org/apache/hive/jdbc/ZooKeeperHiveClientHelper.java