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

    https://github.com/apache/spark/pull/11340#discussion_r54191886
  
    --- Diff: core/src/main/scala/org/apache/spark/TaskContextImpl.scala ---
    @@ -55,14 +58,30 @@ private[spark] class TaskContextImpl(
         this
       }
     
    -  override def addTaskCompletionListener(f: TaskContext => Unit): 
this.type = {
    -    onCompleteCallbacks += new TaskCompletionListener {
    -      override def onTaskCompletion(context: TaskContext): Unit = 
f(context)
    -    }
    +  override def addTaskFailureListener(listener: TaskFailureListener): 
this.type = {
    +    onFailureCallbacks += listener
         this
       }
     
    -  /** Marks the task as completed and triggers the listeners. */
    +  /** Marks the task as completed and triggers the failure listeners. */
    +  private[spark] def markTaskFailed(error: Throwable): Unit = {
    +    val errorMsgs = new ArrayBuffer[String](2)
    +    // Process complete callbacks in the reverse order of registration
    +    onFailureCallbacks.reverse.foreach { listener =>
    --- End diff --
    
    Not sure how much it matters at all since it is an one time only operation 
and usually the number of callbacks is in the range of 0 to 2. Prepending 
efficiently would require us to not use the arraybuffer too.



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