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: Stuart Douglas <sdouglas_at_redhat.com>
Date: Thu, 27 Apr 2017 11:49:04 +1000

On Wed, Apr 26, 2017 at 9:30 PM, Greg Wilkins <gregw_at_webtide.com> wrote:
>
>
> 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.


+1

Something we should clarify though is do tasks submitted through
start() count as a 'thread dispatched by the container'. i.e. if I
call start followed by execute() will the execute task wait for the
start() task to complete before running?

Stuart

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