tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Ludwig <mil...@gmx.de>
Subject Re: Can tomcat detect disconnection by client side in Async mode?
Date Mon, 06 Dec 2010 21:11:42 GMT
Ben schrieb am 05.12.2010 um 14:25 (+0800):
> 
> Any idea about the disconnection handling? Cannot find reference for
> this.
> 
> In my application the client may disconnect

Nitpick: It may *abort* the TCP connection. Don't know why, but it seems
to me that this is only ever called "disconnect" by mistake.

> and send a new request with different parameters. On server side I
> wanna clean the AsynContext held by previous request.

Will the server even be notified? I still don't know if and how any HTTP
server will be notified of this infamous "user hit the cancel button"
event.

Here's a thread back from 2002 in which a user inquired whether a
servlet is notified of the "stop button" event:

RE: Notification when HTTP client aborted connection?
http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg71310.html

The question arises what the servlet should do on learning the user
pressed the stop button? Press the virtual stop button on the database
connection? This requires something like a signal being sent to the
servlet, or the servlet doing non-blocking database IO, which I'm not
sure is implemented anywhere.

> Right now only timeout will do, which is not efficient cos I set the
> timeout to quite high value to avoid frequent disconnect / connect.

http://download.oracle.com/javaee/6/api/javax/servlet/AsyncContext.html
http://download.oracle.com/javaee/6/api/javax/servlet/AsyncListener.html

Will the container call onComplete or onError on the AsyncListener in
this case? Will the container even be notified (by the OS?) of the TCP
connection being aborted by the peer?

Currently reading this article, might be of interest:

Asynchronous servlets in Servlet Spec 3.0
http://www.softwareengineeringsolutions.com/blogs/2010/08/13/asynchronous-servlets-in-servlet-spec-3-0/

-- 
Michael Ludwig

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message