I checked out the trunk and compiled (didn't think it would be so
long, i even got oom with tests (should adjust Xmx i guess)
2.7.1-SNAPSHOT

I tried a simple timeout on jonas 5.3M6 (tomcat 7.0.22) with following code :

    @GET
    @Path("/timeout/{timeout}")
    @Produces("text/plain")
    public void timeout(@PathParam("timeout") String timeoutStr,
@Suspended AsyncResponse ar) {
        long timeout = Long.parseLong(timeoutStr);
        System.out.println("timeout - enter with timeout=" + timeoutStr + "s");
        ar.setTimeoutHandler(new TimeoutHandlerImpl("Timeouted after "
+ timeout + " seconds"));
        ar.setTimeout(timeout, TimeUnit.SECONDS);
    }

    private class TimeoutHandlerImpl implements TimeoutHandler {
        private String _message;

        public TimeoutHandlerImpl(String message) {
            _message = message;
        }

        public void handleTimeout(AsyncResponse ar) {
            System.out.println("handleTimeout - enter");
            ar.resume(_message);
        }
    }

And got the following exception :
2012-11-14 23:11:42,242 : CoyoteAdapter.asyncDispatch : null
java.lang.IllegalStateException: Calling [asyncTimeout()] is not valid
for a request with Async state [DISPATCHING]
at org.apache.coyote.AsyncStateMachine.asyncTimeout(AsyncStateMachine.java:240)
at 
org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:820)
at org.apache.coyote.Request.action(Request.java:346)
at org.apache.catalina.core.AsyncContextImpl.timeout(AsyncContextImpl.java:110)
at 
org.apache.catalina.connector.CoyoteAdapter.asyncDispatch(CoyoteAdapter.java:292)
at 
org.apache.coyote.http11.AbstractHttp11Processor.asyncDispatch(AbstractHttp11Processor.java:1515)
at 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:563)
at 
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)

I didn't have time to inspect things because it's late ... so I just
dump the code and the exception, sorry.

Reply via email to