jsr369-experts@servlet-spec.java.net

[jsr369-experts] Re: [servlet-spec users] Re: execute(Runnable) Was: Race between error page dispatch and async servlet

From: Greg Wilkins <gregw_at_webtide.com>
Date: Wed, 26 Apr 2017 13:30:02 +0200

On 26 April 2017 at 12:15, Mark Thomas <markt_at_apache.org> wrote:

>
> I'd prefer execute(Runnable) as that means we don't have to expose an
> executor to the application.
>
>
We may as well make AsyncContext implement Executor then. Either way, I
think "execute" is the right name and right semantic.

Is adding the 'one thread at a time' restriction to
> AsyncContext#start(Runnable) not an option? Or does that put too much of
> a restriction on existing applications?
>

There are still use-cases for running multiple non serialized threads in
the scope of the request/context. You may need multiple concurrent worker
threads, all with access to the context classloader and the permissions
associated with the request, but that do not need to be serialised with
container threads because they don't actually change the response state.

So keeping start (with it's bad name) is required.

Execute is an additional semantic that makes async apps easier. I can
imagine applications that work out a result using multiple calls to start
and then call execute to write out the response so produced.

cheers



-- 
Greg Wilkins <gregw@webtide.com> CTO http://webtide.com