Github user bOOm-X commented on a diff in the pull request:
https://github.com/apache/spark/pull/18083#discussion_r120619672
--- 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) {
--- End diff --
Indeed ! But you can put the option in the collection listenersPlusTimers
(instead of doing a orNull when you create the timer) and so you can use it
without having to recreate one each time in the postToAll method
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]