Timeout on asynchronous servlet does not work on AJP connector in EAP 6.0
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, tools, and much more.