jsr369-experts@servlet-spec.java.net

[jsr369-experts] Re: [servlet-spec users] Re: Re: Clarification of threading requirements of section 6.2.3

From: Mark Thomas <markt_at_apache.org>
Date: Wed, 10 Dec 2014 10:04:32 +0000

On 10/12/2014 01:20, Eugene Chung(정의근) wrote:
>
> On Tue, Dec 9, 2014 at 8:13 AM, Stuart Douglas
> <stuart.w.douglas_at_gmail.com <mailto:stuart.w.douglas_at_gmail.com>> wrote:

<snip/>

> I guess my main concern here is that there is not really any way to
> hand off to another thread so that only one thread can be using the
> request/response at a time.
>
> Basically I am talking about some kind of AsyncContext.delayStart()
> construct that will not dispatch the task until the current call
> stack has returned to the container (or just change the semantics of
> start() to match). This will make sure that only one thread is using
> the request and response, without needing to resort to
> synchronization or other thread safety constructs.
>
> Stuart
>
>
>
> +1
>
> For AsyncContext.dispatch methods, there is the explanation.
>
> " .... If this method is called before the container-initiated dispatch
> that called startAsync has returned to the container, the dispatch
> operation will be delayed until after the container-initiated dispatch
> has returned to the container. ..... "
>
> I also think AsyncContext.start() should have same requirement.

I have no objections to that. It removes a lot of potential complexity
around thread-safety between the container thread and the application
thread.

Mark