Merge -c 1186554 from trunk to branch-0.23 to complete fix for MAPREDUCE-3188.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1186555 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2115478185
commit
ffccd70d7a
|
@ -1652,6 +1652,8 @@ Release 0.23.0 - Unreleased
|
|||
MAPREDUCE-3179. Ensure failed tests exit with right error code. (Jonathan
|
||||
Eagles via acmurthy)
|
||||
|
||||
MAPREDUCE-3188. Ensure correct shutdown in services. (todd via acmurthy)
|
||||
|
||||
Release 0.22.0 - Unreleased
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -91,14 +91,16 @@ public class AsyncDispatcher extends AbstractService implements Dispatcher {
|
|||
@Override
|
||||
public void stop() {
|
||||
stopped = true;
|
||||
eventHandlingThread.interrupt();
|
||||
try {
|
||||
eventHandlingThread.join();
|
||||
} catch (InterruptedException ie) {
|
||||
LOG.debug("Interruped Exception while stopping", ie);
|
||||
if (eventHandlingThread != null) {
|
||||
eventHandlingThread.interrupt();
|
||||
try {
|
||||
eventHandlingThread.join();
|
||||
} catch (InterruptedException ie) {
|
||||
LOG.debug("Interrupted Exception while stopping", ie);
|
||||
}
|
||||
}
|
||||
|
||||
//stop all the components
|
||||
// stop all the components
|
||||
super.stop();
|
||||
}
|
||||
|
||||
|
|
|
@ -63,8 +63,12 @@ public abstract class AbstractService implements Service {
|
|||
|
||||
@Override
|
||||
public synchronized void stop() {
|
||||
if (state == STATE.STOPPED) {
|
||||
return;//already stopped
|
||||
if (state == STATE.STOPPED ||
|
||||
state == STATE.INITED ||
|
||||
state == STATE.NOTINITED) {
|
||||
// already stopped, or else it was never
|
||||
// started (eg another service failing canceled startup)
|
||||
return;
|
||||
}
|
||||
ensureCurrentState(STATE.STARTED);
|
||||
changeState(STATE.STOPPED);
|
||||
|
|
|
@ -50,6 +50,7 @@ public abstract class AbstractLivelinessMonitor<O> extends AbstractService {
|
|||
|
||||
@Override
|
||||
public void start() {
|
||||
assert !stopped : "starting when already stopped";
|
||||
checkerThread = new Thread(new PingChecker());
|
||||
checkerThread.setName("Ping Checker");
|
||||
checkerThread.start();
|
||||
|
@ -59,7 +60,9 @@ public abstract class AbstractLivelinessMonitor<O> extends AbstractService {
|
|||
@Override
|
||||
public void stop() {
|
||||
stopped = true;
|
||||
checkerThread.interrupt();
|
||||
if (checkerThread != null) {
|
||||
checkerThread.interrupt();
|
||||
}
|
||||
super.stop();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue