Github user bOOm-X commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18083#discussion_r119584011
  
    --- Diff: core/src/main/scala/org/apache/spark/util/ListenerBus.scala ---
    @@ -56,14 +68,25 @@ private[spark] trait ListenerBus[L <: AnyRef, E] 
extends Logging {
         // JavaConverters can create a JIterableWrapper if we use asScala.
         // However, this method will be called frequently. To avoid the 
wrapper cost, here we use
         // Java Iterator directly.
    -    val iter = listeners.iterator
    +    val iter = listenersPlusTimers.iterator
         while (iter.hasNext) {
    -      val listener = iter.next()
    +      val listenerAndMaybeTimer = iter.next()
    +      val listener = listenerAndMaybeTimer._1
    +      val maybeTimer = listenerAndMaybeTimer._2
    +      var maybeTimerContext = if (maybeTimer != null) {
    +        maybeTimer.time()
    +      } else {
    +        null
    +      }
           try {
             doPostEvent(listener, event)
           } catch {
             case NonFatal(e) =>
               logError(s"Listener ${Utils.getFormattedClassName(listener)} 
threw an exception", e)
    +      } finally {
    +        if (maybeTimerContext != null) {
    --- End diff --
    
    Same. simpler with an option


---
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