CompletableFuture (original) (raw)

Doug Lea dl at cs.oswego.edu
Wed Nov 28 12:34:41 PST 2012


On 11/28/12 14:55, David M. Lloyd wrote:

Yes, but it only allows for one dependency per task. It makes more sense to turn it around and thus be able to do:

WhateverFuture x = Task.of(e -> foo(e)).dependsOn(future1).dependsOn(future2).release();

Here's how to make trees/dags:

t1 = new CompletableFuture(); t2 = t1.then(fun1); t3 = t1.then(fun2); t4 = t2.then(fun3); t5 = new CompletableFuture(); t6 = t1.and(t3, fun4);

This gives you (hoping the ascii-arg makes it through):

/ -> t2 -> t4

t1 \ -> t3
t5 -----> & t6

Does that help?

-Doug



More information about the lambda-libs-spec-observers mailing list