diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/StatsNoJobTask.java ql/src/java/org/apache/hadoop/hive/ql/exec/StatsNoJobTask.java index f5d2163..9c3a664 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/StatsNoJobTask.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/StatsNoJobTask.java @@ -345,14 +345,15 @@ private void shutdownAndAwaitTermination(ExecutorService threadPool) { try { // Wait a while for existing tasks to terminate - if (!threadPool.awaitTermination(100, TimeUnit.SECONDS)) { - // Cancel currently executing tasks - threadPool.shutdownNow(); + while (!threadPool.awaitTermination(10, TimeUnit.SECONDS)) { + LOG.debug("Waiting for all stats tasks to finish..."); + } + // Cancel currently executing tasks + threadPool.shutdownNow(); - // Wait a while for tasks to respond to being cancelled - if (!threadPool.awaitTermination(100, TimeUnit.SECONDS)) { - LOG.debug("Stats collection thread pool did not terminate"); - } + // Wait a while for tasks to respond to being cancelled + if (!threadPool.awaitTermination(100, TimeUnit.SECONDS)) { + LOG.debug("Stats collection thread pool did not terminate"); } } catch (InterruptedException ie) {