From 6b8122458ede9ececb138bed99d368580e5439a1 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. --- .../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 02452a3ccd..0b349518e4 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 @@ static void logThrowableFromAfterExecute(Runnable r, Throwable t) { //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);