users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Can a method accepting AsyncResponse be re-entered ?

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Fri, 28 Sep 2012 10:50:42 +0100

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 ?

Cheers, Sergey


[1]
http://jax-rs-spec.java.net/nonav/2.0-SNAPSHOT/apidocs/javax/ws/rs/container/TimeoutHandler.html