tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Cazan <paul_ca...@yahoo.com>
Subject Re: How to handle client disconnection in 'no timeout' async servlets?
Date Fri, 10 Jun 2011 13:11:31 GMT
Is it possible that Tomcat 7.0.14 did not implement any sort of 'onDisconne=
ctEvent' for asynchronous servlets 3.0?

I am sure tomcat DOES KNOW when a client browser is closed, since the notif=
ication arrives when using CometProcessor.

Did anyone worked with asynchronous servlets as in Servlet 3.0 specificatio=
n?
--- On Thu, 9/6/11, Paul Cazan <paul_cazan@yahoo.com> wrote:

From: Paul Cazan <paul_cazan@yahoo.com>
Subject: How to handle client disconnection in 'no timeout' async servlets?
To: users@tomcat.apache.org
Date: Thursday, 9 June, 2011, 3:22 PM

Hello,
I am using Tomcat 7.0.14. I used to have a servlet implementing CometProces=
sor to process asynchronous streams, with timeout set very high (Integer.MA=
X_VALUE), and all worked fine. When I close the browser, the servlet is not=
ified immediately about that (CometEvent.EventType.END) and I am happy to d=
o the cleanup.
No, I have created an async servlet 3.0, and all works as I expected, excep=
t for notification when the browser is closed. I used request.startAsync(),=
 I added AsyncListener, and none of the events get fired when the browser i=
s suddenly closed. Since I set the timeout to a large value (Long.MAX_VALUE=
), AsyncListener.onTimeout will never get called.
As far as I understand, onComplete will get called only when I call AsyncCo=
ntext.complete(), and I do not know when to call it. I tried to write on re=
sponse.getWriter(), expecting to see an exception, but no exception was thr=
own after a couple of writes.
How can I handle this situation using servlet api 3.0, when the user closes=
 the browser or hits the stop button? I need to do the cleanup for that cli=
ent.Meanwhile, I reverted the source code to CometProcessor.
Thanks a lot,Paul
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message