Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Threading issue with AsyncListener.onTimeout

Hi,

On Fri, Oct 28, 2016 at 9:31 AM, Christoph Läubrich
<laeubi@xxxxxxxxxxxxxx> wrote:
> Just a short question so I get things right: If I do not dispatch myself
> won't the container dispatch always if I do not call complete() from the
> onTimeout? From the documentation of AsyncContext they mention:
>
> "If none of the listeners called complete() or any of the dispatch()
> methods, perform an error dispatch with a status code equal to
> HttpServletResponse.SC_INTERNAL_SERVER_ERROR"
>
> I'm not just sure what an error-dispatch mean, will only error handler be
> called or will my servlet be called first or only if no error handler is
> present?

An error dispatch is a dispatch with DispatcherType.ERROR.
Typically Servlets are not mapped for this DispatcherType (but only
for DispatcherType.REQUEST), so the container won't call your Servlet
but trigger instead the error handling mechanism.

> so you recommend to set the timeout to 0 and fire of an own Scheduler to
> actually timeout for any non trivial use-case? Sounds like a good workaround
> at least for my case since I already have a worker pool of threads.

If you have to do non-blocking writes, then yes this is the only workaround.

We are going to change the call to onTimeout() to be executed from a
pooled thread, so for blocking writes I guess it's similar to use
either the built-in timeout, or your own scheduler.

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.


Back to the top