MAPREDUCE-4794. DefaultSpeculator generates error messages on normal shutdown (Jason Lowe via jeagles)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1451831 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Turner Eagles 2013-03-02 03:45:21 +00:00
parent cd1aca1c82
commit a5985e4b0e
2 changed files with 9 additions and 3 deletions

View File

@ -605,6 +605,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

View File

@ -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<SpeculatorEvent> eventQueue
= new LinkedBlockingQueue<SpeculatorEvent>();
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();