15 package com.cloudera.impala.catalog;
17 import java.util.concurrent.ConcurrentLinkedQueue;
19 import org.apache.hadoop.hive.conf.HiveConf;
20 import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
21 import org.apache.log4j.Logger;
23 import com.google.common.base.Preconditions;
32 "impala.catalog.metastore.cnxn.creation.delay.ms";
38 private static final Logger
LOG = Logger.getLogger(MetaStoreClientPool.class);
40 private final ConcurrentLinkedQueue<MetaStoreClient>
clientPool_ =
41 new ConcurrentLinkedQueue<MetaStoreClient>();
55 LOG.debug(
"Creating MetaStoreClient. Pool Size = " + clientPool_.size());
56 this.hiveClient_ =
new HiveMetaStoreClient(hiveConf);
57 }
catch (Exception e) {
59 throw new IllegalStateException(e);
61 this.isInUse_ =
false;
105 this.hiveConf_ = hiveConf;
115 for (
int i = 0; i < numClients; ++i) {
129 if (
Thread.currentThread().getContextClassLoader() == null) {
130 Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader());
137 synchronized (
this) {
140 }
catch (InterruptedException e) {
143 if (client == null) {
171 client.getHiveClient().
close();