tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juriy Bura <>
Subject Call to dispatch in onTimeout
Date Sat, 20 Nov 2010 15:09:11 GMT
Hello guys,

Could you please give some comments if the code below is legal from the
Servlet 3.0 spec point of view?

       AsyncContext context = request.startAsync();
        context.addListener(new AsyncListener() {

            public void onComplete(AsyncEvent asyncEvent) throws IOException

            public void onTimeout(AsyncEvent asyncEvent) throws IOException
                System.out.println("HITTING TIMEOUT");

            public void onError(AsyncEvent asyncEvent) throws IOException {}

            public void onStartAsync(AsyncEvent asyncEvent) throws
IOException {}

I'm calling the AsyncContext.dispatch() method inside the onTimeout callback
of the listener. On the latest build (7.0.4) it throws the exception:

java.lang.IllegalStateException: Calling [dispatchAsync()] is not valid for
a request with Async state [TIMING_OUT]

// Juriy

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message