private static AmsThriftUrl parserZookeeperUrl(String url, String serviceName) {
    String thriftUrl = url;
    String query = "";
    if (url.contains("?")) {
      query = url.substring(url.indexOf("?"));
      thriftUrl = url.substring(0, url.indexOf("?"));
    }
    Matcher m = PATTERN.matcher(thriftUrl);
    if (m.matches()) {
      String zkServerAddress;
      String cluster;
      String catalog = "";
      if (m.group(1).contains("/")) {
        zkServerAddress = m.group(1).substring(0, m.group(1).indexOf("/"));
        cluster = m.group(1).substring(m.group(1).indexOf("/") + 1);
        catalog = m.group(2);
      } else {
        zkServerAddress = m.group(1);
        cluster = m.group(2);
      }
      int retryCount = 0;
      while (retryCount < MAX_RETRIES) {
        try {
          AmsServerInfo serverInfo = findAmsServerInfo(serviceName, zkServerAddress, cluster);
          url =
              String.format(
                  THRIFT_URL_FORMAT,
                  serverInfo.getHost(),
                  serverInfo.getThriftBindPort(),
                  catalog,
                  query);
          int socketTimeout = DEFAULT_SOCKET_TIMEOUT;
          for (String paramExpression : query.replace("?", "").split("&")) {
            String[] paramSplit = paramExpression.split("=");
            if (paramSplit.length == 2) {
              if (paramSplit[0].equalsIgnoreCase(PARAM_SOCKET_TIMEOUT)) {
                socketTimeout = Integer.parseInt(paramSplit[1]);
              }
            }
          }
          return new AmsThriftUrl(
              "thrift",
              serverInfo.getHost(),
              serverInfo.getThriftBindPort(),
              catalog.toLowerCase(),
              socketTimeout,
              url);
        } catch (KeeperException.AuthFailedException authFailedException) {
          // If kerberos authentication is not enabled on the zk,
          // an error occurs when the thread carrying kerberos authentication information accesses
          // the zk.
          // Therefore, clear the authentication information and try again
          retryCount++;
          logger.error(
              String.format("Caught exception, retrying... (retry count: %s)", retryCount),
              authFailedException);
          try {
            Subject subject = Subject.getSubject(java.security.AccessController.getContext());

            if (subject != null) {
              LoginContext loginContext = new LoginContext("", subject);
              loginContext.logout();
            }
          } catch (LoginException e) {
            logger.error("Failed to logout", e);
          }
        } catch (Exception e) {
          retryCount++;
          logger.error(
              String.format("Caught exception, retrying... (retry count: %s)", retryCount), e);
          throw new RuntimeException(String.format("invalid ams url %s", url));
        }
      }
    } else {
      throw new RuntimeException(String.format("invalid ams url %s", url));
    }
    return null;
  }
parse thrift url, now support thrift://host:port/{catalogName} and
zookeeper://host:port/{cluster}/{catalogName} . parse to AmsThriftUrl that contains properties
schema, host, port, catalogName, socketTimeout, url.

@param url - thrift url
@return -
amoro-common/src/main/java/org/apache/amoro/client/AmsThriftUrl.java