summaryrefslogtreecommitdiff
path: root/src/library/scala/concurrent/Promise.scala
diff options
context:
space:
mode:
authorHeather Miller <heather.miller@epfl.ch>2012-01-31 13:07:13 +0100
committerHeather Miller <heather.miller@epfl.ch>2012-01-31 13:07:13 +0100
commit0d23e83d136436109c957fb44ac328bdfaa8a658 (patch)
tree646bb4c4f69d933b70d5565669e5ecdd7c024b7a /src/library/scala/concurrent/Promise.scala
parent8f36bf7a71f29af5ab61a3f58897881932c1daa3 (diff)
downloadscala-0d23e83d136436109c957fb44ac328bdfaa8a658.tar.gz
scala-0d23e83d136436109c957fb44ac328bdfaa8a658.tar.bz2
scala-0d23e83d136436109c957fb44ac328bdfaa8a658.zip
Replaced Either with Try throughout scala.concurrent.
Diffstat (limited to 'src/library/scala/concurrent/Promise.scala')
-rw-r--r--src/library/scala/concurrent/Promise.scala10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/library/scala/concurrent/Promise.scala b/src/library/scala/concurrent/Promise.scala
index acc02fba5f..f26deb77ab 100644
--- a/src/library/scala/concurrent/Promise.scala
+++ b/src/library/scala/concurrent/Promise.scala
@@ -8,7 +8,7 @@
package scala.concurrent
-
+import scala.util.{ Try, Success, Failure }
@@ -42,7 +42,7 @@ trait Promise[T] {
*
* $promiseCompletion
*/
- def complete(result: Either[Throwable, T]): this.type = if (tryComplete(result)) this else throwCompleted
+ def complete(result:Try[T]): this.type = if (tryComplete(result)) this else throwCompleted
/** Tries to complete the promise with either a value or the exception.
*
@@ -50,7 +50,7 @@ trait Promise[T] {
*
* @return If the promise has already been completed returns `false`, or `true` otherwise.
*/
- def tryComplete(result: Either[Throwable, T]): Boolean
+ def tryComplete(result: Try[T]): Boolean
/** Completes this promise with the specified future, once that future is completed.
*
@@ -77,7 +77,7 @@ trait Promise[T] {
*
* @return If the promise has already been completed returns `false`, or `true` otherwise.
*/
- def trySuccess(value: T): Boolean = tryComplete(Right(value))
+ def trySuccess(value: T): Boolean = tryComplete(Success(value))
/** Completes the promise with an exception.
*
@@ -95,7 +95,7 @@ trait Promise[T] {
*
* @return If the promise has already been completed returns `false`, or `true` otherwise.
*/
- def tryFailure(t: Throwable): Boolean = tryComplete(Left(t))
+ def tryFailure(t: Throwable): Boolean = tryComplete(Failure(t))
/** Wraps a `Throwable` in an `ExecutionException` if necessary. TODO replace with `resolver` from scala.concurrent
*