Index: hcatalog/core/src/main/java/org/apache/hive/hcatalog/common/HiveClientCache.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- hcatalog/core/src/main/java/org/apache/hive/hcatalog/common/HiveClientCache.java (revision 1635644) +++ hcatalog/core/src/main/java/org/apache/hive/hcatalog/common/HiveClientCache.java (revision ) @@ -33,6 +33,7 @@ import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.HiveMetaStoreClient; +import org.apache.hadoop.hive.metastore.RetryingMetaStoreClient; import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.hive.shims.ShimLoader; import org.apache.hadoop.security.UserGroupInformation; @@ -77,7 +78,7 @@ } public static HiveMetaStoreClient getNonCachedHiveClient(HiveConf hiveConf) throws MetaException { - return new HiveMetaStoreClient(hiveConf); + return (HiveMetaStoreClient)RetryingMetaStoreClient.getProxy(hiveConf, null, HiveMetaStoreClient.class.getName()); } public HiveClientCache(HiveConf hiveConf) { @@ -216,7 +217,11 @@ return hiveCache.get(cacheKey, new Callable() { @Override public CacheableHiveMetaStoreClient call() throws MetaException { - return new CacheableHiveMetaStoreClient(cacheKey.getHiveConf(), timeout); + return (CacheableHiveMetaStoreClient) + RetryingMetaStoreClient.getProxy(cacheKey.getHiveConf(), + new Class[]{HiveConf.class, Integer.class}, + new Object[]{cacheKey.getHiveConf(), timeout}, + CacheableHiveMetaStoreClient.class.getName()); } }); } catch (ExecutionException e) { Index: metastore/src/java/org/apache/hadoop/hive/metastore/RetryingMetaStoreClient.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- metastore/src/java/org/apache/hadoop/hive/metastore/RetryingMetaStoreClient.java (revision 1635644) +++ metastore/src/java/org/apache/hadoop/hive/metastore/RetryingMetaStoreClient.java (revision ) @@ -55,25 +55,45 @@ protected RetryingMetaStoreClient(HiveConf hiveConf, HiveMetaHookLoader hookLoader, Class msClientClass) throws MetaException { + + this(hiveConf, + new Class[] { HiveConf.class, HiveMetaHookLoader.class }, + new Object[] {hiveConf, hookLoader}, + msClientClass); + } + + protected RetryingMetaStoreClient(HiveConf hiveConf, Class[] constructorArgTypes, Object[] constructorArgs, + Class msClientClass) throws MetaException { this.retryLimit = hiveConf.getIntVar(HiveConf.ConfVars.METASTORETHRIFTFAILURERETRIES); this.retryDelaySeconds = hiveConf.getTimeVar( HiveConf.ConfVars.METASTORE_CLIENT_CONNECT_RETRY_DELAY, TimeUnit.SECONDS); reloginExpiringKeytabUser(); - this.base = MetaStoreUtils.newInstance(msClientClass, new Class[] { - HiveConf.class, HiveMetaHookLoader.class}, new Object[] {hiveConf, hookLoader}); + + this.base = MetaStoreUtils.newInstance(msClientClass, constructorArgTypes, constructorArgs); } public static IMetaStoreClient getProxy(HiveConf hiveConf, HiveMetaHookLoader hookLoader, String mscClassName) throws MetaException { - Class baseClass = (Class) - MetaStoreUtils.getClass(mscClassName); + return getProxy(hiveConf, + new Class[]{ HiveConf.class, HiveMetaHookLoader.class }, + new Object[]{ hiveConf, hookLoader}, + mscClassName + ); + } - RetryingMetaStoreClient handler = new RetryingMetaStoreClient(hiveConf, hookLoader, baseClass); + public static IMetaStoreClient getProxy(HiveConf hiveConf, Class[] constructorArgTypes, Object[] constructorArgs, + String mscClassName) throws MetaException { + + Class baseClass + = (Class) MetaStoreUtils.getClass(mscClassName); + + RetryingMetaStoreClient handler = new RetryingMetaStoreClient(hiveConf, constructorArgTypes, + constructorArgs, baseClass); return (IMetaStoreClient) Proxy.newProxyInstance(RetryingMetaStoreClient.class.getClassLoader(), - baseClass.getInterfaces(), handler); + baseClass.getInterfaces(), handler); } @Override