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";
|
return "foo";
|
||||||
}
|
}
|
||||||
}, ec);
|
}, ec);
|
||||||
Future<String> result = Futures.firstCompletedOf(
|
Future<String> result = future.either(delayed);
|
||||||
Arrays.asList(future, delayed), ec);
|
|
||||||
//#after
|
//#after
|
||||||
Await.result(result, Duration.create(2, SECONDS));
|
Await.result(result, Duration.create(2, SECONDS));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -381,10 +381,10 @@ class FutureDocSpec extends AkkaSpec {
|
||||||
//#after
|
//#after
|
||||||
import akka.pattern.after
|
import akka.pattern.after
|
||||||
|
|
||||||
val delayed = after(500 millis, using = system.scheduler)(Promise.failed(
|
val delayed = after(200 millis, using = system.scheduler)(Future.failed(
|
||||||
new IllegalStateException("OHNOES")).future)
|
new IllegalStateException("OHNOES")))
|
||||||
val future = Future { Thread.sleep(1000); "foo" }
|
val future = Future { Thread.sleep(1000); "foo" }
|
||||||
val result = Future.firstCompletedOf(Seq(Promise[String]().future, delayed))
|
val result = future either delayed
|
||||||
//#after
|
//#after
|
||||||
intercept[IllegalStateException] { Await.result(result, 2 second) }
|
intercept[IllegalStateException] { Await.result(result, 2 second) }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue