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

    https://github.com/apache/spark/pull/20039#discussion_r158538406
  
    --- Diff: 
core/src/main/scala/org/apache/spark/scheduler/LiveListenerBus.scala ---
    @@ -124,13 +127,19 @@ private[spark] class LiveListenerBus(conf: SparkConf) 
{
       }
     
       /** Post an event to all queues. */
    -  def post(event: SparkListenerEvent): Unit = {
    -    if (!stopped.get()) {
    -      metrics.numEventsPosted.inc()
    +  def post(event: SparkListenerEvent): Unit = synchronized {
    +    if (stopped.get()) {
    +      return
    +    }
    --- End diff --
    
    No. It's needed because you have to make sure that when the buffered events 
are posted to the queues in `start()`, this method cannot be called. Otherwise 
you need to have a contract that this class is not thread-safe until after 
`start()` is called.


---

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

Reply via email to