On 29/09/2009 09:34, aaime74 wrote:
awarnier wrote:
aaime74 wrote:
...
Hi.
Kind of restarting from the beginning, I think that the first question
to ask is whether whatever method which actually does the rendering of
the maps, and which is "heavy" in terms of resources, is capable of
being interrupted cleanly in the middle. Is it capable itself of
checking regularly if it should continue doing the work ? Or else, if
you "shoot it down" does it mop up after itself, or does it leave stuff
to clean up all over the place ?
I can cleanly stop the rendering process in almost any point of it.
The issue is not stopping it, it's detecting the client connection
was dropped.
No matter what solution is adopted, one still depends on the ability
to detect the client has dropped the connection, something that no
one so far described how to check (I'm starting to wonder if there
is a way at all).
awarnier wrote:
The "(whenever possible)" above refers to the fact that a number of
things outside of your control can come in the way of such detection :
proxies, firewalls and the like. If the ultimate client breaks the
connection, it is not guaranteed that Tomcat itself would notice this
right away.
Ok, but let's say Tomcat is capable of that. How does one check from
within the servlet that the connection has been dropped without writing
out anything? What I've tried so far is trying to block on the input stream
provided by the Http request and hoping it would throw an exception if
the client drop the conntection, but that does not work, the input
stream just return -1 to any "read" operation no matter if the client
is still connected or not.
If you've processed request parameters, the inputstream is empty because
it's already been consumed.
As previously stated, you'd have to try and write something (a header?)
to the outputstream to find out if it's available or not.
hres.addHeader("X-Streamcheck-01", "OK!");
... do some work ...
hres.addHeader("X-Streamcheck-02", "OK!");
p
Cheers
Andrea
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org