From 2b04ae918cfe02290c800e0af12c2746bf1cbc1c Mon Sep 17 00:00:00 2001 From: Naganarasimha Date: Mon, 23 Oct 2017 23:41:38 +0530 Subject: [PATCH] HADOOP-14966. Handle JDK-8071638 for hadoop-common. Contributed by Bibin A Chundatt. (cherry picked from commit 6b8122458ede9ececb138bed99d368580e5439a1) --- .../apache/hadoop/util/concurrent/ExecutorHelper.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/concurrent/ExecutorHelper.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/concurrent/ExecutorHelper.java index 5f22f93af44..caa2584c8c3 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/concurrent/ExecutorHelper.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/concurrent/ExecutorHelper.java @@ -40,14 +40,16 @@ public final class ExecutorHelper { //For additional information, see: https://docs.oracle // .com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor - // .html#afterExecute(java.lang.Runnable,%20java.lang.Throwable) . + // .html#afterExecute(java.lang.Runnable,%20java.lang.Throwable) - if (t == null && r instanceof Future) { + // Handle JDK-8071638 + if (t == null && r instanceof Future && ((Future) r).isDone()) { try { ((Future) r).get(); } catch (ExecutionException ee) { - LOG.warn("Execution exception when running task in " + - Thread.currentThread().getName()); + LOG.warn( + "Execution exception when running task in " + Thread.currentThread() + .getName()); t = ee.getCause(); } catch (InterruptedException ie) { LOG.warn("Thread (" + Thread.currentThread() + ") interrupted: ", ie);