[concurrency-interest] More Javadoc problems

Peter Levart peter.levart at gmail.com
Fri Dec 19 17:16:40 EST 2014


On 12/19/2014 10:39 PM, cowwoc wrote:
> 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

Correct.

Peter

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


More information about the Concurrency-interest mailing list