Github user abellina commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18253#discussion_r129886931
  
    --- Diff: 
core/src/main/scala/org/apache/spark/scheduler/LiveListenerBus.scala ---
    @@ -139,30 +148,60 @@ private[spark] class LiveListenerBus(conf: SparkConf) 
extends SparkListenerBus {
           logError(s"$name has already stopped! Dropping event $event")
           return
         }
    -    metrics.numEventsPosted.inc()
    -    val eventAdded = eventQueue.offer(event)
    -    if (eventAdded) {
    -      eventLock.release()
    +    defaultListenerQueue.post(event)
    +    otherListenerQueues.foreach(q => q.post(event))
    +  }
    +
    +
    +
    +  override private[spark] def findListenersByClass[T <: 
SparkListenerInterface : ClassTag] =
    +    defaultListenerQueue.findListenersByClass ++ 
otherListenerQueues.flatMap(_.findListenersByClass)
    +
    +  override private[spark] def listeners =
    +    defaultListenerQueue.listeners ++ 
otherListenerQueues.flatMap(_.listeners)
    +
    +   /**
    +    * Start sending events to attached listeners.
    +    *
    +    * This first sends out all buffered events posted before this listener 
bus has started, then
    +    * listens for any additional events asynchronously while the listener 
bus is still running.
    +    * This should only be called once.
    +    *
    +    */
    +  def start(sc: SparkContext, ms: MetricsSystem): Unit = {
    +    startStopAddRemoveLock.lock()
    +    if (!started) {
    +      sparkContext = sc
    +      metricsSystem = ms
    +      defaultListenerQueue.start(sc, ms)
    +      otherListenerQueues.foreach(_.start(sc, ms))
    +      started = true
         } else {
    -      onDropEvent(event)
    +      throw new IllegalStateException("LiveListener bus already started!")
    --- End diff --
    
    definitely want to unlock before this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to