Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/3710#discussion_r21932227
--- Diff:
streaming/src/main/scala/org/apache/spark/streaming/scheduler/StreamingListenerBus.scala
---
@@ -17,20 +17,25 @@
package org.apache.spark.streaming.scheduler
-import org.apache.spark.Logging
-import scala.collection.mutable.{SynchronizedBuffer, ArrayBuffer}
+import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.LinkedBlockingQueue
+import java.util.concurrent.CopyOnWriteArrayList
+
+import scala.collection.JavaConversions._
+import scala.util.control.NonFatal
+
+import org.apache.spark.Logging
+import org.apache.spark.util.Utils
/** Asynchronously passes StreamingListenerEvents to registered
StreamingListeners. */
private[spark] class StreamingListenerBus() extends Logging {
- private val listeners = new ArrayBuffer[StreamingListener]()
- with SynchronizedBuffer[StreamingListener]
+ private val listeners = new CopyOnWriteArrayList[StreamingListener]()
/* Cap the capacity of the SparkListenerEvent queue so we get an
explicit error (rather than
* an OOM exception) if it's perpetually being added to more quickly
than it's being drained. */
private val EVENT_QUEUE_CAPACITY = 10000
private val eventQueue = new
LinkedBlockingQueue[StreamingListenerEvent](EVENT_QUEUE_CAPACITY)
- private var queueFullErrorMessageLogged = false
+ private val queueFullErrorMessageLogged = new AtomicBoolean(false)
--- End diff --
This change seems fine to me, but we should probably apply the same fix to
LiveListenerBus as well:
https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/scheduler/LiveListenerBus.scala#L38
---
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]