diff --git a/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java b/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java index a3fde341ea..1bfaf3c745 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java @@ -1325,37 +1325,37 @@ public void loadAuxJars() throws IOException { * @throws IOException */ public void loadReloadableAuxJars() throws IOException { - final Set reloadedAuxJars = new HashSet(); + LOG.info("Reloading auxiliary JAR files"); final String renewableJarPath = sessionConf.getVar(ConfVars.HIVERELOADABLEJARS); // do nothing if this property is not specified or empty - if (renewableJarPath == null || renewableJarPath.isEmpty()) { + if (StringUtils.isBlank(renewableJarPath)) { + LOG.warn("Configuration {} not specified", ConfVars.HIVERELOADABLEJARS); return; } - Set jarPaths = FileUtils.getJarFilesByPath(renewableJarPath, sessionConf); - // load jars under the hive.reloadable.aux.jars.path - if(!jarPaths.isEmpty()){ - reloadedAuxJars.addAll(jarPaths); - } + final Set jarPaths = FileUtils.getJarFilesByPath(renewableJarPath, sessionConf); + + LOG.info("Auxiliary JAR files discovered for reload: {}", jarPaths); // remove the previous renewable jars - if (preReloadableAuxJars != null && !preReloadableAuxJars.isEmpty()) { - Utilities.removeFromClassPath(preReloadableAuxJars.toArray(new String[0])); + if (!preReloadableAuxJars.isEmpty()) { + Utilities + .removeFromClassPath(preReloadableAuxJars.toArray(new String[0])); } - if (reloadedAuxJars != null && !reloadedAuxJars.isEmpty()) { + if (!jarPaths.isEmpty()) { URLClassLoader currentCLoader = (URLClassLoader) SessionState.get().getConf().getClassLoader(); currentCLoader = (URLClassLoader) Utilities.addToClassPath(currentCLoader, - reloadedAuxJars.toArray(new String[0])); + jarPaths.toArray(new String[0])); sessionConf.setClassLoader(currentCLoader); Thread.currentThread().setContextClassLoader(currentCLoader); } preReloadableAuxJars.clear(); - preReloadableAuxJars.addAll(reloadedAuxJars); + preReloadableAuxJars.addAll(jarPaths); } static void registerJars(List newJars) throws IllegalArgumentException {