jsr340-experts@servlet-spec.java.net

[jsr340-experts] Re: [servlet-spec users] SERVLET_SPEC-6: Undefined behaviour for AsyncContext#getRequest() and getResponse() after timeout

From: Shing Wai Chan <shing.wai.chan_at_oracle.com>
Date: Mon, 30 Jan 2012 12:29:31 -0800

On 1/30/12 10:34 AM, Shing Wai Chan wrote:
> Greg Wilkins have a comment in issue tracker,
> http://java.net/jira/browse/SERVLET_SPEC-6 :
> Basically, it is about reuse of request objects.
> If we allow the reuse of request objects, then calling
> AsyncContext#getRequest or using the request object should be
> undefined after timeout.
> Similarly for response.
>
> I plan to change the behavior as described above.
I have a second thought on this.
If an exception is already thrown, then one do not get the request object.
But we may still like to clarify that the behavior of using previously
acquired request or response objects are undefined.
(But this also mean that the request/response are not linked to async
context after request/response are recycled (not necessary vice versa).
  This is more an implementation details.)

Shing Wai Chan
>
> Shing Wai Chan
>
>
> On 12/16/11 4:19 PM, Shing Wai Chan wrote:
>> In this case, should we throw IllegalStateException for
>> AsyncContext#getRequest() / getResponse()
>> if AsyncContext#complete or AsyncContext#dispatch are called.
>> This will solve the following timeout scenario, too.
>> Shing Wai Chan
>>
>> On 8/31/11 5:12 AM, Mark Thomas wrote:
>>> On 31/08/2011 01:17, Shing Wai Chan wrote:
>>>> In http://java.net/jira/browse/SERVLET_SPEC-6, it would like to have a
>>>> clarification on the behavior of AsyncContext#getRequest() and
>>>> getResponse() after timeout.
>>>>
>>>> I think with the comment that one should throw
>>>> IllegalStateException in
>>>> those circumstances.
>>>> I have a question.
>>>>
>>>> According to javadoc of AsyncContext, when there is async timeout, the
>>>> following may be invoked:
>>>> a. invoke AsyncListener#onTimeout
>>>> b. AsyncContext#complete, AsyncListener#onComplete
>>>> c. AsyncContext#dispatch
>>>>
>>>> In (a), (b) and (c) above, should we throw IllegalStateException?
>>> I think not. All of those are fine during the processing of a timeout.
>>> After the timeout, they should throw IllegalStateException.
>>>
>>> Mark
>>
>