users@jax-rs-spec.java.net

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

From: Bill Burke <bburke_at_redhat.com>
Date: Tue, 06 Aug 2013 12:54:51 -0400

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 "


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.


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