Skip to content
Snippets Groups Projects
Commit 09f76092 authored by Reynold Xin's avatar Reynold Xin
Browse files

Properly handle interrupted exception in FutureAction.

parent 42fb1df6
No related branches found
No related tags found
No related merge requests found
...@@ -177,13 +177,11 @@ class CancellablePromise[T] extends FutureAction[T] with Promise[T] { ...@@ -177,13 +177,11 @@ class CancellablePromise[T] extends FutureAction[T] with Promise[T] {
def run(func: => T)(implicit executor: ExecutionContext): Unit = scala.concurrent.future { def run(func: => T)(implicit executor: ExecutionContext): Unit = scala.concurrent.future {
thread = Thread.currentThread thread = Thread.currentThread
try { try {
this.success({ if (cancelled) {
if (cancelled) { // This action has been cancelled before this thread even started running.
// This action has been cancelled before this thread even started running. this.failure(new SparkException("action cancelled"))
throw new InterruptedException }
} this.success(func)
func
})
} catch { } catch {
case e: Exception => this.failure(e) case e: Exception => this.failure(e)
} finally { } finally {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment