diff options
Diffstat (limited to 'core/src/main/scala/org/apache/spark/TaskContext.scala')
-rw-r--r-- | core/src/main/scala/org/apache/spark/TaskContext.scala | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/core/src/main/scala/org/apache/spark/TaskContext.scala b/core/src/main/scala/org/apache/spark/TaskContext.scala index 742828a227..1e9cb0a432 100644 --- a/core/src/main/scala/org/apache/spark/TaskContext.scala +++ b/core/src/main/scala/org/apache/spark/TaskContext.scala @@ -103,21 +103,6 @@ abstract class TaskContext extends Serializable { @deprecated("Local execution was removed, so this always returns false", "2.0.0") def isRunningLocally(): Boolean - // TODO(josh): this used to be an overload of addTaskCompletionListener(), but the overload - // became ambiguous under Scala 2.12. For now, I'm renaming this in order to get the code to - // compile, but we need to figure out a long-term solution which maintains at least source - // compatibility (and probably binary compatibility) for Java callers. - /** - * Adds a (Java friendly) listener to be executed on task completion. - * This will be called in all situations - success, failure, or cancellation. Adding a listener - * to an already completed task will result in that listener being called immediately. - * - * An example use is for HadoopRDD to register a callback to close the input stream. - * - * Exceptions thrown by the listener will result in failure of the task. - */ - def addJavaFriendlyTaskCompletionListener(listener: TaskCompletionListener): TaskContext - /** * Adds a listener in the form of a Scala closure to be executed on task completion. * This will be called in all situations - success, failure, or cancellation. Adding a listener @@ -127,31 +112,13 @@ abstract class TaskContext extends Serializable { * * Exceptions thrown by the listener will result in failure of the task. */ - def addTaskCompletionListener(f: (TaskContext) => Unit): TaskContext = { - addJavaFriendlyTaskCompletionListener(new TaskCompletionListener { - override def onTaskCompletion(context: TaskContext): Unit = f(context) - }) - } - - // TODO(josh): this used to be an overload of addTaskFailureListener(), but the overload - // became ambiguous under Scala 2.12. For now, I'm renaming this in order to get the code to - // compile, but we need to figure out a long-term solution which maintains at least source - // compatibility (and probably binary compatibility) for Java callers. - /** - * Adds a listener to be executed on task failure. Adding a listener to an already failed task - * will result in that listener being called immediately. - */ - def addJavaFriendlyTaskFailureListener(listener: TaskFailureListener): TaskContext + def addTaskCompletionListener(listener: TaskCompletionListener): TaskContext /** * Adds a listener to be executed on task failure. Adding a listener to an already failed task * will result in that listener being called immediately. */ - def addTaskFailureListener(f: (TaskContext, Throwable) => Unit): TaskContext = { - addJavaFriendlyTaskFailureListener(new TaskFailureListener { - override def onTaskFailure(context: TaskContext, error: Throwable): Unit = f(context, error) - }) - } + def addTaskFailureListener(listener: TaskFailureListener): TaskContext /** * The ID of the stage that this task belong to. |