CompletionStage (was: Re: Loose ends: Optional -> CompletableFuture -> Eventual)

Doug Lea dl at cs.oswego.edu
Sun Jun 30 05:58:20 PDT 2013


On 06/27/13 19:29, Doug Lea wrote:

> Assuming not, I still do owe all of those people who were so
> unhappy about tabling discussion of a read-only interface for
> CompletableFuture another shot at it in light of the
> fact that we've nailed down other issues whose pending
> status was the main reason for dropping.
>

The simplest possible solution to this seems to be the best.
New interface CompletionStage extracts all and (almost) only the
"fluent" methods from CompletableFuture. No status methods,
result access, blocking, cancellation, etc. Which requires
(almost) no API change to CompletableFuture either.

The "almost" is added method toCompletableFuture(), that
is a kind of safe-cast/conversion to enable interoperability
among implementations. Sorta like Collection.toArray.

As a sanity check before committing, posting on concurrency-interest,
and trying to talk my way past deadline-sensitive
OpenJDK integration folks, I placed at

  http://gee.cs.oswego.edu/dl/wwwtmp/CompletionStage.java
  http://gee.cs.oswego.edu/dl/wwwtmp/CompletableFuture.java

Any comments or suggestions would be very welcome.

-Doug




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