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

    https://github.com/apache/spark/pull/1195#discussion_r14313824
  
    --- Diff: 
streaming/src/main/scala/org/apache/spark/streaming/receiver/BlockGenerator.scala
 ---
    @@ -134,9 +168,26 @@ private[streaming] class BlockGenerator(
         logError(message, t)
         listener.onError(message, t)
       }
    -  
    +
       private def pushBlock(block: Block) {
         listener.onPushBlock(block.id, block.buffer)
    +
    +    var callbackBufferOpt: Option[ArrayBuffer[Callback]] = None
    +    // Remove the buffer from the callbacks map. This must be synchronized 
to ensure no one else
    +    // is editing the buffer or the map at that time.
    +    synchronized {
    +      callbackBufferOpt = Option(callbacks.remove(block.id))
    +    }
    +
    +    // Call the callbacks
    +    callbackBufferOpt match {
    +      case Some(callbackBuffer) =>
    +        callbackBuffer.map(callback => {
    --- End diff --
    
    Thanks! One lesson a day :)


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

Reply via email to