Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/10779#discussion_r50197743
--- Diff:
streaming/src/main/scala/org/apache/spark/streaming/scheduler/StreamingListenerBus.scala
---
@@ -51,12 +68,31 @@ private[spark] class StreamingListenerBus
}
}
- override def onDropEvent(event: StreamingListenerEvent): Unit = {
- if (logDroppedEvent.compareAndSet(false, true)) {
- // Only log the following message once to avoid duplicated annoying
logs.
- logError("Dropping StreamingListenerEvent because no remaining room
in event queue. " +
- "This likely means one of the StreamingListeners is too slow and
cannot keep up with the " +
- "rate at which events are being started by the scheduler.")
- }
+ /**
+ * Register this one with the Spark listener bus so that it can receive
Streaming events and
+ * forward them to StreamingListeners.
+ */
+ def start(): Unit = {
+ sparkListenerBus.addListener(this) // for getting callbacks on spark
events
+ }
+
+ /**
+ * Unregister this one with the Spark listener bus and all
StreamingListeners won't receive any
+ * events after that.
+ */
+ def stop(): Unit = {
+ sparkListenerBus.removeListener(this)
+ }
+
+ /**
+ * Wrapper for StreamingListenerEvent as SparkListenerEvent so that it
can be posted to Spark
+ * listener bus.
+ */
+ case class WrappedStreamingListenerEvent(
+ streamingListenerEvent: StreamingListenerEvent) extends
SparkListenerEvent {
--- End diff --
prefer style:
```
private case class WrapperStreamingListenerEvent(event:
StreamingListenerEvent)
extends SparkListenerEvent {
...
}
```
---
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]