[concurrency-interest] No *Task counterpart of CompletableFuture?

Tomas Mikula tomas.mikula at gmail.com
Mon Feb 10 19:24:38 EST 2014


I really like the addition of the CompletionStage interface in 1.8.
However, there is just one implementation of it and that is
CompletableFuture. I am missing a task counterpart of it, i.e.
something that is both a Future and a CompletionStage, but is
completed by a computation (i.e. takes a Callable constructor argument
or has a protected abstract compute() method).

I imagine a hierarchy like this:

interface CompletionFuture<T> extends Future<T>, CompletionStage<T> {}

class CompletableFuture<T> implements CompletionFuture<T> {...}

class CompletionFutureTask<T> implements CompletionFuture<T> {
    public CompletionFutureTask(Callable<T> callable) {...}
    // or
    protected abstract T compute();

Is there a reason why this is missing? Is there a plan to add this?


More information about the Concurrency-interest mailing list