YARN=5526. DrainDispacher#serviceStop blocked if setDrainEventsOnStop invoked (sandflee via Varun Saxena)
This commit is contained in:
parent
20f0eb871c
commit
913a895136
|
@ -148,7 +148,7 @@ public class AsyncDispatcher extends AbstractService implements Dispatcher {
|
||||||
YarnConfiguration.DEFAULT_DISPATCHER_DRAIN_EVENTS_TIMEOUT);
|
YarnConfiguration.DEFAULT_DISPATCHER_DRAIN_EVENTS_TIMEOUT);
|
||||||
|
|
||||||
synchronized (waitForDrained) {
|
synchronized (waitForDrained) {
|
||||||
while (!drained && eventHandlingThread != null
|
while (!isDrained() && eventHandlingThread != null
|
||||||
&& eventHandlingThread.isAlive()
|
&& eventHandlingThread.isAlive()
|
||||||
&& System.currentTimeMillis() < endTime) {
|
&& System.currentTimeMillis() < endTime) {
|
||||||
waitForDrained.wait(1000);
|
waitForDrained.wait(1000);
|
||||||
|
@ -303,4 +303,8 @@ public class AsyncDispatcher extends AbstractService implements Dispatcher {
|
||||||
protected boolean isEventThreadWaiting() {
|
protected boolean isEventThreadWaiting() {
|
||||||
return eventHandlingThread.getState() == Thread.State.WAITING;
|
return eventHandlingThread.getState() == Thread.State.WAITING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean isDrained() {
|
||||||
|
return drained;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,6 +94,11 @@ public class DrainDispatcher extends AsyncDispatcher {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isDrained() {
|
||||||
|
return drained;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void serviceStop() throws Exception {
|
protected void serviceStop() throws Exception {
|
||||||
stopped = true;
|
stopped = true;
|
||||||
|
|
Loading…
Reference in New Issue