[concurrency-interest] More Javadoc problems

cowwoc cowwoc at bbs.darktech.org
Fri Dec 19 09:13:47 EST 2014


cowwoc wrote
> Hi guys,
> 
> The Javadoc for CompletableFuture.whenComplete() reads:
> 
> "If the supplied action itself encounters an exception, then the returned
> stage exceptionally completes with this exception unless this stage also
> completed exceptionally."
> 
> Huh?!
> 
> So if the original stage completed with exception1 but the handler threw
> exception2, which exception does the returned CompleteableFuture complete
> with? The specification says what *won't* happen if the stage also
> completed exceptionally, but it doesn't say what *will* happen. Please
> clarify :)

It looks like in practice, exception1 is thrown and exception2 is lost.

Couldn't you at least add exception2 as a "suppressed" exception?

Gili



--
View this message in context: http://jsr166-concurrency.10961.n7.nabble.com/More-Javadoc-problems-tp11669p11670.html
Sent from the JSR166 Concurrency mailing list archive at Nabble.com.


More information about the Concurrency-interest mailing list