diff options
author | Philipp Haller <hallerp@gmail.com> | 2011-12-07 18:24:28 +0100 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2011-12-07 18:24:28 +0100 |
commit | 2c01191b99d912f99a7d50be693d09406761a94c (patch) | |
tree | 4dc46f441754c197aa611bea8ea9c415e2938abe /src/library/scala/concurrent/Promise.scala | |
parent | 5ccc928f7ec2e79c793ee1b31ca8e91321688749 (diff) | |
download | scala-2c01191b99d912f99a7d50be693d09406761a94c.tar.gz scala-2c01191b99d912f99a7d50be693d09406761a94c.tar.bz2 scala-2c01191b99d912f99a7d50be693d09406761a94c.zip |
Add promise implementation. Move fork/join implementation into default package. Factor commonalities of promises and tasks into Completable.
Diffstat (limited to 'src/library/scala/concurrent/Promise.scala')
-rw-r--r-- | src/library/scala/concurrent/Promise.scala | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/library/scala/concurrent/Promise.scala b/src/library/scala/concurrent/Promise.scala index 898344cb66..33953f2fca 100644 --- a/src/library/scala/concurrent/Promise.scala +++ b/src/library/scala/concurrent/Promise.scala @@ -44,14 +44,21 @@ trait Promise[T] { * * $promiseCompletion */ - def fail(t: Throwable): Unit - - /** The timeout for this promise. + def break(t: Throwable): Unit + + /** Wraps a `Throwable` in an `ExecutionException` if necessary. + * + * $allowedThrowables */ - def timeout: Timeout + protected def wrap(t: Throwable): Throwable = t match { + case t: Throwable if isFutureThrowable(t) => t + case _ => new ExecutionException(t) + } + } + object Promise { /* /** |