[concurrency-interest] More Javadoc problems

cowwoc cowwoc at bbs.darktech.org
Fri Dec 19 16:39:54 EST 2014


On 19/12/2014 4:30 PM, cowwoc wrote:
> On 19/12/2014 4:10 PM, Peter Levart wrote:
>> If you want to change the exceptional OR nonexceptional outcome of 
>> preceeding stage, then use handle() instead of whenComplete().
>
> I can't.
>
> If you handle() and attempt to re-throw the same exception, you will get:
>
>     unreported exception Throwable; must be caught or declared to be 
> thrown
>
> I agree that whenComplete() is meant to act as a finally block (which 
> removes the need to do this funky casting). What I don't like is that 
> join() returns without waiting for the result of whenComplete(). If 
> the case of a real try-finally block, the code after the block does 
> not execute after finally completes. I am trying to implement the same 
> behavior here.
>
> What should I be doing instead?

Actually, I think I'm fine.

I've got a function that returns 
"CompletableFuture.supplyAsync(lambda).whenComplete(lambda)" and I 
join() on that. So technically speaking, I believe this means I am 
joining against the second stage (after whenComplete() has run). Is that 
correct?

Gili
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20141219/497384ec/attachment.html>


More information about the Concurrency-interest mailing list