Timeout on asynchronous servlet does not work on AJP connector in EAP 6.0

Solution Unverified - Updated -

Issue

When using asyncronous servlets and defining a timeout and a listener on the context like the following:

@WebServlet(name = "AsyncTestServlet", urlPatterns = { "/async" }, asyncSupported = true)
public class AsyncTestServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        AsyncContext ac = request.startAsync();
        ac.setTimeout(timeout);
        ac.addListener(new MyAsyncServiceListener());
        // ...(snip)...

    }

    // ...(snip)...

    private static class MyAsyncServiceListener implements AsyncListener {
        public void onComplete(AsyncEvent arg0) throws IOException {
            System.out.println("Complete");
        }
        public void onError(AsyncEvent arg0) throws IOException {
            System.out.println("Error");
        }
        public void onStartAsync(AsyncEvent arg0) throws IOException {
            System.out.println("Start");
        }
        public void onTimeout(AsyncEvent arg0) throws IOException {
            System.out.println("Timeout");
        }
    }
}

The onTimeout() method of the listener is never called when a request is running on AJP connector though the timeout works fine on HTTP/HTTPS connector.

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 6.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.