From 38c4e17ec1e5b6068414227495be81beb808b85f Mon Sep 17 00:00:00 2001 From: Jonathan Turner Eagles Date: Sat, 2 Mar 2013 03:30:58 +0000 Subject: [PATCH] MAPREDUCE-4794. DefaultSpeculator generates error messages on normal shutdown (Jason Lowe via jeagles) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1451826 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../mapreduce/v2/app/speculate/DefaultSpeculator.java | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) 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();