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 'onDisconnectEvent' for asynchronous
servlets 3.0?

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

Did anyone worked with asynchronous servlets as in Servlet 3.0 specification?
--- 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 CometProcessor to process
asynchronous streams, with timeout set very high (Integer.MAX_VALUE), and all worked fine.
When I close the browser, the servlet is notified immediately about that (CometEvent.EventType.END)
and I am happy to do the cleanup.
No, I have created an async servlet 3.0, and all works as I expected, except for notification
when the browser is closed. I used request.startAsync(), I added AsyncListener, and none of
the events get fired when the browser is 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 AsyncContext.complete(),
and I do not know when to call it. I tried to write on response.getWriter(), expecting to
see an exception, but no exception was thrown 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 client.Meanwhile, I reverted the source
code to CometProcessor.
Thanks a lot,Paul
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message