YARN=5526. DrainDispacher#serviceStop blocked if setDrainEventsOnStop invoked (sandflee via Varun Saxena)

This commit is contained in:
Varun Saxena 2016-08-18 12:23:34 +05:30
parent 07d5ab16df
commit 5fa7a14da9
2 changed files with 10 additions and 1 deletions

View File

@ -148,7 +148,7 @@ public class AsyncDispatcher extends AbstractService implements Dispatcher {
YarnConfiguration.DEFAULT_DISPATCHER_DRAIN_EVENTS_TIMEOUT);
synchronized (waitForDrained) {
while (!drained && eventHandlingThread != null
while (!isDrained() && eventHandlingThread != null
&& eventHandlingThread.isAlive()
&& System.currentTimeMillis() < endTime) {
waitForDrained.wait(1000);
@ -303,4 +303,8 @@ public class AsyncDispatcher extends AbstractService implements Dispatcher {
protected boolean isEventThreadWaiting() {
return eventHandlingThread.getState() == Thread.State.WAITING;
}
protected boolean isDrained() {
return drained;
}
}

View File

@ -94,6 +94,11 @@ public class DrainDispatcher extends AsyncDispatcher {
};
}
@Override
protected boolean isDrained() {
return drained;
}
@Override
protected void serviceStop() throws Exception {
stopped = true;