aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReynold Xin <rxin@apache.org>2013-10-11 11:20:15 -0700
committerReynold Xin <rxin@apache.org>2013-10-11 11:20:15 -0700
commit09f7609254a8b70a551e7403bc5378434318b3f4 (patch)
tree0bc58e0a2856da2c581874686135b7ab7f0a3944
parent42fb1df694541892df76ae9765b613d2c1c10c0b (diff)
downloadspark-09f7609254a8b70a551e7403bc5378434318b3f4.tar.gz
spark-09f7609254a8b70a551e7403bc5378434318b3f4.tar.bz2
spark-09f7609254a8b70a551e7403bc5378434318b3f4.zip
Properly handle interrupted exception in FutureAction.
-rw-r--r--core/src/main/scala/org/apache/spark/FutureAction.scala12
1 files changed, 5 insertions, 7 deletions
diff --git a/core/src/main/scala/org/apache/spark/FutureAction.scala b/core/src/main/scala/org/apache/spark/FutureAction.scala
index 64e354e2e3..9f41912d6c 100644
--- a/core/src/main/scala/org/apache/spark/FutureAction.scala
+++ b/core/src/main/scala/org/apache/spark/FutureAction.scala
@@ -177,13 +177,11 @@ class CancellablePromise[T] extends FutureAction[T] with Promise[T] {
def run(func: => T)(implicit executor: ExecutionContext): Unit = scala.concurrent.future {
thread = Thread.currentThread
try {
- this.success({
- if (cancelled) {
- // This action has been cancelled before this thread even started running.
- throw new InterruptedException
- }
- func
- })
+ if (cancelled) {
+ // This action has been cancelled before this thread even started running.
+ this.failure(new SparkException("action cancelled"))
+ }
+ this.success(func)
} catch {
case e: Exception => this.failure(e)
} finally {