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

    https://github.com/apache/spark/pull/10779#discussion_r50051890
  
    --- Diff: 
streaming/src/main/scala/org/apache/spark/streaming/scheduler/StreamingSparkListenerAdapter.scala
 ---
    @@ -17,19 +17,16 @@
     
     package org.apache.spark.streaming.scheduler
     
    -import java.util.concurrent.atomic.AtomicBoolean
    +import org.apache.spark.scheduler.{SparkListener, SparkListenerEvent}
     
    -import org.apache.spark.Logging
    -import org.apache.spark.util.AsynchronousListenerBus
    -
    -/** Asynchronously passes StreamingListenerEvents to registered 
StreamingListeners. */
    -private[spark] class StreamingListenerBus
    -  extends AsynchronousListenerBus[StreamingListener, 
StreamingListenerEvent]("StreamingListenerBus")
    -  with Logging {
    -
    -  private val logDroppedEvent = new AtomicBoolean(false)
    +/**
    + * A SparkListener adapter for StreamingListener that will dispatch the 
Streaming events to
    + * the underlying StreamingListener.
    + */
    +private[spark] class StreamingSparkListenerAdapter(listener: 
StreamingListener)
    --- End diff --
    
    Making StreamingListener extend SparkListener has a tricky issue. 
    
    Image someone implements both StreamingListener and SparkListener in the 
current codes. Then he needs to register this one with SparkContext and 
StreamingContext. If we make StreamingListener extend SparkListener, the user 
usually won't notice this change as his codes can be compiled successfully, 
however, the listener receives SparkListenerEvent twice and cause very tricky 
issue and hard to find the real problem.


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

Reply via email to