diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 28f38b72a4b..c2d70dc4808 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -754,6 +754,9 @@ Release 0.23.7 - UNRELEASED mapred-default has mapreduce.job.split.metainfo.maxsize (Jason Lowe via jeagles) + MAPREDUCE-4794. DefaultSpeculator generates error messages on normal + shutdown (Jason Lowe via jeagles) + Release 0.23.6 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/DefaultSpeculator.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/DefaultSpeculator.java index 25f9820b9a6..b2e437b10d1 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/DefaultSpeculator.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/speculate/DefaultSpeculator.java @@ -91,6 +91,7 @@ public class DefaultSpeculator extends AbstractService implements private final Configuration conf; private AppContext context; private Thread speculationBackgroundThread = null; + private volatile boolean stopped = false; private BlockingQueue eventQueue = new LinkedBlockingQueue(); private TaskRuntimeEstimator estimator; @@ -170,7 +171,7 @@ public class DefaultSpeculator extends AbstractService implements = new Runnable() { @Override public void run() { - while (!Thread.currentThread().isInterrupted()) { + while (!stopped && !Thread.currentThread().isInterrupted()) { long backgroundRunStartTime = clock.getTime(); try { int speculations = computeSpeculations(); @@ -189,8 +190,9 @@ public class DefaultSpeculator extends AbstractService implements Object pollResult = scanControl.poll(wait, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { - LOG.error("Background thread returning, interrupted : " + e); - e.printStackTrace(System.out); + if (!stopped) { + LOG.error("Background thread returning, interrupted", e); + } return; } } @@ -205,6 +207,7 @@ public class DefaultSpeculator extends AbstractService implements @Override public void stop() { + stopped = true; // this could be called before background thread is established if (speculationBackgroundThread != null) { speculationBackgroundThread.interrupt();