[concurrency-interest] Reusing CompletableFuture

Pavel Rappo pavel.rappo at gmail.com
Sun Jul 24 16:20:02 EDT 2016


Hi Doug,

Pardon me, are you sure you replied to Martin rather than to Viktor?
Viktor has suggested using CS instead of CF. What Martin has asked is
whether it makes sense to have something which is-a CompletableFuture
but without the "obtrude" logic.

On Sun, Jul 24, 2016 at 8:41 PM, Doug Lea <dl at cs.oswego.edu> wrote:
> On 07/24/2016 03:32 PM, Martin Buchholz wrote:
>
>> It may make sense to reuse CompletableFutures where the mutability has
>> been
>> removed, e.g. by subclassing.
>> Are we safe if we override just obtrudeValue and obtrudeException on a
>> completed
>> future?
>> Should j.u.c. provide such a thing?
>
>
> It takes a long enough time to put out major releases that it is easy
> to forget that this has been in CompletableFuture for almost a year,
> but still not routinely available until jdk9:
>
>     /**
>      * Returns a new CompletionStage that is already completed with
>      * the given value and supports only those methods in
>      * interface {@link CompletionStage}.
>      *
>      * @param value the value
>      * @param <U> the type of the value
>      * @return the completed CompletionStage
>      * @since 9
>      */
>     public static <U> CompletionStage<U> completedStage(U value) {
>         return new MinimalStage<U>((value == null) ? NIL : value);
>
>     }
>
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest


More information about the Concurrency-interest mailing list