Re: CompletableStage.whenComplete(): Completes the stage after calling the BiConsumer

Martin Buchholz via Concurrency-interest <[email protected]>
Newsgroups gmane.comp.java.jsr.166-concurrency
Message-ID <CA+kOe08th+XTUwhOn4euFmE8aQYdoZm-jRZe+4T4H=+nyZw-xA@mail.gmail.com>
https://docs.oracle.com/en/java/javase/13/docs/api/java.base/java/util/concurrent/CompletionStage.html#whenComplete(java.util.function.BiConsumer)

On Thu, Nov 7, 2019 at 10:49 AM Nathan and Ila Reynolds via
Concurrency-interest <[email protected]> wrote:

> For CompletableStage.whenComplete(), the Javadoc says "The returned
> stage is completed when the action returns."  What is the reasoning for
> completing the future after action returns?


The result of the returned stage depends on whether the action failed or
not.


> How do I run action after
> the future completes?
>

Why can't you just attach a completion action to either the stage returned
by whenComplete or its source?

_______________________________________________
Concurrency-interest mailing list
[email protected]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.