users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: Async.setTimeout conflicts with servlet's setTimeout

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Mon, 12 Aug 2013 10:20:48 +0300

On 06/08/13 19:54, Bill Burke wrote:
> JAX-RS AsyncResponse.setTimeout() javadoc implies that this method can
> be called in any thread....
>
> Unfortunately, if you build AsyncResponse on top of the Servlet 3 async
> APIs, AsyncContext.setTimeout() can only be executed in the same thread
> as the initial HTTP request.
>
> "IllegalStateException - if this method is called after the
> container-initiated dispatch, during which one of the
> ServletRequest#startAsync methods was called, has returned to the
> container "

I read it like this: "if the container-initiated dispatch has returned
to the container (i.e, has completed) and setTimeout is called
afterwards then throw ISE"

Cheers, Sergey
>
>
> Don't you agree JAX-RS AsyncResponse.setTimeout() should be
> implementable in a pure Servlet 3 environment?
>
> This issue came up in the Java EE 7 TCK JAX-RS async tests. The tests
> invoke setTimeout() in a separate thread. I'd like to challenge this.
>
>