jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: [jax-rs-spec users] Re: AsyncResponse should be able to accept responses immediately

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Mon, 1 Oct 2012 13:29:51 -0700

On Oct 1, 2012, at 4:30 AM, Sergey Beryozkin <sberyozkin_at_talend.com> wrote:

>
>>
>> Regarding returning boolean vs throwing an exception.
>> I think it does not make a difference.
>>
>> This is because the runtime effectively guarantees that the application
>> level code (original resource method accepting AsyncResponse or
>> TimeoutHandler) does always see a 'suspended' AsyncResponse.
>>
>> However, after saying the above, I guess returning 'boolean' and
>> updating the docs to simply say that say "resume(...) -> Resumes the
>> suspended invocation, timeout(...) -> extends the suspended invocation,
>> cancel(...) - cancels the suspended invocation" would probably be the
>> right thing to do
>>
> After checking
> http://jax-rs-spec.java.net/nonav/2.0-SNAPSHOT/apidocs/javax/ws/rs/container/ResumeCallback.html,
>
> I think I favor IllegalStateException, the way things are done now, because attempting to resume/cancel/timeout in the callback is an exception...

That is an orthogonal use case...

Marek
>
> Cheers, Sergey