using thenCombine instead of join to merge to CompletableFuture (#31304)
This commit is contained in:
parent
060ffc7b71
commit
b5c29e05c0
1 changed files with 1 additions and 8 deletions
|
|
@ -841,14 +841,7 @@ public class ActorDocTest extends AbstractJavaTest {
|
||||||
// using timeout from above
|
// using timeout from above
|
||||||
CompletableFuture<Object> future2 = ask(actorB, "another request", t).toCompletableFuture();
|
CompletableFuture<Object> future2 = ask(actorB, "another request", t).toCompletableFuture();
|
||||||
|
|
||||||
CompletableFuture<Result> transformed =
|
CompletableFuture<Result> transformed = future1.thenCombine(future2, (x, s) -> new Result((String) x, (String) s));
|
||||||
CompletableFuture.allOf(future1, future2)
|
|
||||||
.thenApply(
|
|
||||||
v -> {
|
|
||||||
String x = (String) future1.join();
|
|
||||||
String s = (String) future2.join();
|
|
||||||
return new Result(x, s);
|
|
||||||
});
|
|
||||||
|
|
||||||
pipe(transformed, system.dispatcher()).to(actorC);
|
pipe(transformed, system.dispatcher()).to(actorC);
|
||||||
// #ask-pipe
|
// #ask-pipe
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue