Created
June 12, 2014 03:27
-
-
Save yufan-liu/ef8486edee3bc4bced89 to your computer and use it in GitHub Desktop.
Spark event dispatcher.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// version spark 1.0.0 | |
// file org.apache.spark.scheduler.LiveListenerBus | |
private val listenerThread = new Thread("SparkListenerBus") { | |
setDaemon(true) | |
override def run(): Unit = Utils.logUncaughtExceptions { | |
while (true) { | |
eventLock.acquire() | |
// Atomically remove and process this event | |
LiveListenerBus.this.synchronized { | |
val event = eventQueue.poll | |
if (event == SparkListenerShutdown) { | |
// Get out of the while loop and shutdown the daemon thread | |
return | |
} | |
Option(event).foreach(postToAll) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment