diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java index 6a6fd43..a6c4ec3 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java @@ -433,13 +433,15 @@ public HMSHandler(String name, HiveConf conf, boolean init) throws MetaException super(name); hiveConf = conf; isInTest = HiveConf.getBoolVar(hiveConf, ConfVars.HIVE_IN_TEST); - synchronized (HMSHandler.class) { - if (threadPool == null) { - int numThreads = HiveConf.getIntVar(conf, - ConfVars.METASTORE_FS_HANDLER_THREADS_COUNT); - threadPool = Executors.newFixedThreadPool(numThreads, - new ThreadFactoryBuilder().setDaemon(true) - .setNameFormat("HMSHandler #%d").build()); + if (threadPool == null) { + synchronized (HMSHandler.class) { + if (threadPool == null) { + int numThreads = HiveConf.getIntVar(conf, + ConfVars.METASTORE_FS_HANDLER_THREADS_COUNT); + threadPool = Executors.newFixedThreadPool(numThreads, + new ThreadFactoryBuilder().setDaemon(true) + .setNameFormat("HMSHandler #%d").build()); + } } } if (init) {