On Sep 28, 2012, at 2:50 AM, Sergey Beryozkin <sberyozkin_at_talend.com> wrote:
> Hi,
>
> I'd like to clarify the way the timed-out suspended invocations are handled.
>
> Consider the following:
>
> 1. A method such as
>
> @GET
> void getIt(@Suspended AsyncResponse asyncResp) {
> // store asyncResp reference
> return;
>
> }
>
> is entered for the first time. Note, 'asyncResp' is already in the 'suspended' state - for a method like 'getIt' be able to immediately 'resume' or 'cancel' the request.
>
> 2. Some time after getIt exits the suspended 'asyncResp' times out and by default WebApplicationException(503) is to be thrown.
>
> 3. If 2. is not acceptable, TimeoutHandler [1] is to be registered.
>
> Basically, the way I see it, a method like 'getIt' is only ever entered once for a current request, from then on it is always TimeoutHandler that will decide what to do with the async response.
>
>
> Is it the right interpretation that a resource method accepting AsyncResponse can not be re-entered ?
Yes, (IIUC the above).
Marek
>
> Cheers, Sergey
>
>
> [1] http://jax-rs-spec.java.net/nonav/2.0-SNAPSHOT/apidocs/javax/ws/rs/container/TimeoutHandler.html