Skip to content

Commit

Permalink
Address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
wangshuo128 committed Dec 18, 2019
1 parent 781caba commit 7b8b1fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@
*/
public class SparkFirehoseListener implements SparkListenerInterface {

protected volatile boolean dead;

@Override
public boolean dead() {
return false;
return dead;
}

@Override
public void dead_$eq(boolean dead) { }
public void dead_$eq(boolean dead) {
this.dead = dead;
}

public void onEvent(SparkListenerEvent event) { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ private class AsyncEventQueue(

override def removeListenerOnError(listener: SparkListenerInterface): Unit = {
if (bus.isInStop) {
// If bus is in the progress of stop, we just mark the listener as dead instead of removing
// via calling `bus.removeListener` to avoid race condition
// dead listeners will be removed eventually in `bus.stop`
// If we're in the middle of stopping the bus, we just mark the listener as dead,
// instead of removing, to avoid a deadlock.
// Dead listeners will be removed eventually in `bus.stop`.
listener.dead = true
} else {
// the listener failed in an unrecoverably way, we want to remove it from the entire
Expand Down

0 comments on commit 7b8b1fa

Please sign in to comment.