dengzhhu653 commented on code in PR #6499:
URL: https://github.com/apache/hive/pull/6499#discussion_r3331440174
##########
standalone-metastore/metastore-client/src/main/java/org/apache/hadoop/hive/metastore/client/builder/HiveMetaStoreClientBuilder.java:
##########
@@ -19,41 +19,49 @@
package org.apache.hadoop.hive.metastore.client.builder;
import org.apache.commons.lang3.exception.ExceptionUtils;
+import org.apache.commons.lang3.reflect.ConstructorUtils;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.metastore.HiveMetaHookLoader;
+import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
import org.apache.hadoop.hive.metastore.IMetaStoreClient;
import org.apache.hadoop.hive.metastore.RetryingMetaStoreClient;
import org.apache.hadoop.hive.metastore.api.MetaException;
import org.apache.hadoop.hive.metastore.client.HookEnabledMetaStoreClient;
import org.apache.hadoop.hive.metastore.client.SynchronizedMetaStoreClient;
import org.apache.hadoop.hive.metastore.client.ThriftHiveMetaStoreClient;
import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
-import org.apache.hadoop.hive.metastore.utils.JavaUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.lang.reflect.Constructor;
import java.util.Map;
import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
public class HiveMetaStoreClientBuilder {
private static final Logger LOG =
LoggerFactory.getLogger(HiveMetaStoreClientBuilder.class);
+ private static final Map<Class<? extends IMetaStoreClient>,
MetaStoreClientFactory>
+ CLIENT_FACTORIES = new ConcurrentHashMap<>();
private final Configuration conf;
private IMetaStoreClient client;
- public HiveMetaStoreClientBuilder(Configuration conf) {
- this.conf = Objects.requireNonNull(conf);
- }
-
- public HiveMetaStoreClientBuilder newClient(boolean allowEmbedded) throws
MetaException {
+ public HiveMetaStoreClientBuilder(Configuration configuration, boolean
allowEmbedded) throws MetaException {
+ this.conf = new Configuration(Objects.requireNonNull(configuration));
+ boolean isHiveClient = HiveMetaStoreClient.class.getName().equals(
+ MetastoreConf.getVar(conf,
MetastoreConf.ConfVars.METASTORE_CLIENT_IMPL));
+ if (isHiveClient) {
Review Comment:
Create a new `HiveMetaStoreClientBuilder(Configuration configuration, String
clientImpl,
boolean allowEmbedded) throws MetaException` instead
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]