Incorparate review comments, see #2410

This commit is contained in:
Patrik Nordwall 2012-08-21 09:01:04 +02:00
parent 00f0d1f263
commit fbdf67b316
2 changed files with 4 additions and 5 deletions

View file

@ -526,8 +526,7 @@ public class FutureDocTestBase {
return "foo";
}
}, ec);
Future<String> result = Futures.firstCompletedOf(
Arrays.asList(future, delayed), ec);
Future<String> result = future.either(delayed);
//#after
Await.result(result, Duration.create(2, SECONDS));
}

View file

@ -381,10 +381,10 @@ class FutureDocSpec extends AkkaSpec {
//#after
import akka.pattern.after
val delayed = after(500 millis, using = system.scheduler)(Promise.failed(
new IllegalStateException("OHNOES")).future)
val delayed = after(200 millis, using = system.scheduler)(Future.failed(
new IllegalStateException("OHNOES")))
val future = Future { Thread.sleep(1000); "foo" }
val result = Future.firstCompletedOf(Seq(Promise[String]().future, delayed))
val result = future either delayed
//#after
intercept[IllegalStateException] { Await.result(result, 2 second) }
}