users@jax-rs-spec.java.net

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

From: Bill Burke <bburke_at_redhat.com>
Date: Mon, 12 Aug 2013 08:33:41 -0400

On 8/12/2013 3:20 AM, Sergey Beryozkin wrote:
> 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"
>

For Jetty at least, it ignores the setTimeout call in a separate thread.
  Our servlet guys think that a exception should be thrown. Haven't
tried Tomcat.

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com