On 8/6/2013 1:48 AM, Stuart Douglas wrote:
>
> Am I reading this correctly from the Javadocs? setTimeout() can only be
> called within the thread that suspended the request?
Yes, although it looks like I have not actually implemented this. I will change it to do
what the javadocs say, as otherwise I may have to change it in future if a test is added
to the TCK.
Ran into this in the TCK EE 7 JAX-RS Async tests. JAX-RS javadocs don't
forbid setTimeout() from being called in different threads, SO, OF
COURSE, the TCK EE 7 TCK tests this! I'm going to bring this up with
the JAX-RS expert group and this is something we should challenge on the
JAX-RS side.
Right now, to fix the problem, I run a ScheduledExecutorService with no
initial threads to call AsyncResponse.cancel(). Which of course won't
work if you reset the timer to something higher than the original
timeout :)
Bill
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com