[concurrency-interest] More Javadoc problems
cowwoc at bbs.darktech.org
Fri Dec 19 11:45:38 EST 2014
Can you give a concrete example where observers would witness side-effects?
Assuming what you say is possible, would you object to throwing a clone
of the original exception instance with the suppressed exceptions added?
This way only observers of the 2nd completion stage would observe these
On 19/12/2014 10:40 AM, Josh Humphries wrote:
> I do not disagree. Though one thing to note of this approach is that
> "observers" of the original completion stage (that failed with
> exception 1) will now witness side effects from a *successor*
> completion stage via the suppressed exception. It might be a little
> odd for some consumers to see the state of the Throwable change
> /after/ it has already been (potentially) published to multiple threads.
> I would personally vote that the later completion stage fail
> exceptionally with exception2. But that's a change in behavior that is
> likely to be a non-starter due to being incompatible with the current
> spec (even if only slightly).
> The actual authors of the library are on this list and can likely
> chime in further about why it behaves that way.
> *Josh Humphries*
> Manager, Shared Systems | Platform Engineering
> Atlanta, GA | 678-400-4867
> *Square* (www.squareup.com <http://www.squareup.com>)
> On Fri, Dec 19, 2014 at 9:50 AM, cowwoc <cowwoc at bbs.darktech.org
> <mailto:cowwoc at bbs.darktech.org>> wrote:
> Hi Josh,
> Thanks for the follow-up.
> I'd like to request two changes:
> 1. Add exception2 as a suppressed exception (eating exceptions is
> like silent failures... it's bad business)
> 2. Have the Javadoc to mention what will happen in this case.
> Let me know what you think.
> On 19/12/2014 9:42 AM, Josh Humphries [via JSR166 Concurrency] wrote:
>> Looking at the source code -- the ultimate spec ;) -- the
>> original exception is preferred. So in your example, the
>> resulting CompletionStage completes exceptionally with
>> exception1, and exception2 is effectively eaten.
>> *Josh Humphries*
>> Manager, Shared Systems | Platform Engineering
>> Atlanta, GA | 678-400-4867 <tel:678-400-4867>
>> *Square* (www.squareup.com <http://www.squareup.com>)
>> On Fri, Dec 19, 2014 at 9:00 AM, cowwoc <[hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=11671&i=0>> 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."
>> 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 :)
>> View this message in context:
>> Sent from the JSR166 Concurrency mailing list archive at
>> Concurrency-interest mailing list
>> [hidden email]
>> Concurrency-interest mailing list
>> [hidden email] <http:///user/SendEmail.jtp?type=node&node=11671&i=2>
>> If you reply to this email, your message will be added to the
>> discussion below:
>> To unsubscribe from More Javadoc problems, click here.
> View this message in context: Re: More Javadoc problems
> Sent from the JSR166 Concurrency mailing list archive
> <http://jsr166-concurrency.10961.n7.nabble.com/> at Nabble.com.
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> <mailto:Concurrency-interest at cs.oswego.edu>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest