CompletableFuture

Sam Pullara spullara at gmail.com
Wed Nov 28 11:56:37 PST 2012


Nah, you just join futures.

future1.join(future2).then(e -> foo(e));

Sam

On Nov 28, 2012, at 11:55 AM, "David M. Lloyd" <david.lloyd at redhat.com> 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<T> x = Task.of(e -> foo(e)).dependsOn(future1).dependsOn(future2).release();
> 
> or something.
> 
> On 11/28/2012 12:47 PM, Sam Pullara wrote:
>> I'm confused. The intent is that .then() is just a dependency and the blocks will be executed as soon as it is satisfied. Am I misunderstanding your concern?
>> 
>> Sam
>> 
>> On Nov 28, 2012, at 9:11 AM, "David M. Lloyd" <david.lloyd at redhat.com> wrote:
>>> Maybe this is getting a bit to abstract, but anecdotally speaking we have found that "do A then B" is "less good" than "do B when A is done", i.e. model the problem in terms of tasks and their dependencies rather than as a sequential chain of tasks to run in order.  It's just inherently cleaner and potentially more performant (any given task can execute as soon as its dependencies are satisfied; there are no artificial sequences imposed on tasks).  But, at the same time, that mode of thinking seems to be fairly incompatible with Future.
>>> 
>>> --
>>> - DML
>> 
> 
> 
> -- 
> - DML



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