Incorparate review comments, see #2410
This commit is contained in:
parent
00f0d1f263
commit
fbdf67b316
2 changed files with 4 additions and 5 deletions
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue