Hello,
I have encountered this rather strange problem in tomcat 7:
I have a servlet that process requests witch asynchronous API
(async-supported=true):
AsyncContext async = req.startAsync(req, resp);
async.addListener(...);
async.setTimeout(8*60*1000);
addToMap(id, async.getResponse());
I store response in some map for further reuse.
Problem comes when user closes connection (standard socket.close()) before
timeout. There is no signal from server that this happened, and everything
works the same way.
on async signal do { // every few sec.
try {
writer = response.getWriter();
writer.print(object);
writer.flush();
} catch(Exception ex) {
//invalid connection do something
}
}
This part of code was used as for sending response. Invalid connections
should be discovered when
IOExceptions was thrown while flushing. But there is no exception when
client disconnects before timeout. Writer is flushing somewhere without
exception. The only exception that is thrown is timeout exception after 8
minutes. So it is doing lot of redundant calls before handling.
This code works as I wish with CometProcessor.
So is there some way to discover that client has closed connection or this
is the standard behavior.
I used tomcat 7.0.16 with APR (windows 7)
Peter Cipov
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org