@VisibleForTesting
  public static HMSClient createHiveMetaStoreClient(HiveConf hiveConf) {
    try {
      try {
        HiveMetaStoreClient client = CLIENT_CTOR.newInstance(hiveConf);
        return new HMSClientImpl(client);
      } catch (RuntimeException e) {
        // any MetaException would be wrapped into RuntimeException during reflection, so
        // let's double-check type
        // here
        if (e.getCause() instanceof MetaException) {
          throw (MetaException) e.getCause();
        }
        throw e;
      }
    } catch (MetaException e) {
      throw new RuntimeException("Failed to connect to Hive Metastore", e);
    } catch (Throwable t) {
      LOG.error("Failed to call createHiveMetaStoreClient", t);
      if (t.getMessage().contains("Another instance of Derby may have already booted")) {
        throw new RuntimeException(
            "Failed to start an embedded metastore because embedded "
                + "Derby supports only one client at a time. To fix this, use a metastore that supports "
                + "multiple clients.",
            t);
      }

      throw new RuntimeException("Failed to connect to Hive Metastore", t);
    }
  }
Extended implementation of {@link ClientPoolImpl} with {@link TableMetaStore} to support
authenticated hive cluster.
amoro-common/src/main/java/org/apache/amoro/hive/AuthenticatedHiveClientPool.java