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
|