Skip to content

Commit 9a6f9ff

Browse files
committed
Address Andrew's review comments
1 parent c60b860 commit 9a6f9ff

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

core/src/main/scala/org/apache/spark/util/AsynchronousListenerBus.scala

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,13 @@ private[spark] abstract class AsynchronousListenerBus[L <: AnyRef, E](name: Stri
6666
self.synchronized {
6767
processingEvent = true
6868
}
69-
if (stopped.get()) return
69+
if (stopped.get()) {
70+
// Get out of the while loop and shutdown the daemon thread
71+
return
72+
}
7073
try {
7174
val event = eventQueue.poll
72-
if (event == null) {
73-
// Get out of the while loop and shutdown the daemon thread
74-
if (!stopped.get) {
75-
throw new IllegalStateException("Polling `null` from eventQueue means" +
76-
" the listener bus has been stopped. So `stopped` must be true")
77-
}
78-
return
79-
}
75+
assert(event != null, "event queue was empty but the listener bus was not stopped")
8076
postToAll(event)
8177
} finally {
8278
self.synchronized {

0 commit comments

Comments
 (0)