Soap services, tomcat servlets, detecting dropped client connection

P

Phil Jarvis

I have a soap server running on Tomcat.
The client makes a request, and the server may have to spend some
nontrivial time formulating the response.

WHile the server formulates the response,
the client is killed by the user and the connection is (theoretically)
killed.

Is there a way to detect on the server side that the connection has been
dropped BEFORE any attempt to issue a response to the socket?

I want to get the servlet to cease and desist computation if the
socket is dropped, and if possible I'd like to detect it before my JDBC
transaction completes so I can abort a corresponding database transaction.

Right now I don't get any error until long after my transactions are
closed and the servlet has completed the response for transmission.

Thanks for any tips.

I'm using standard HttpServlet and JAXMservlet stuff on Tomcat 4.

(Does tomcat 5 automatically send some kind of interrupt to my servlet
when the connection is dropped? Maybe all I need to do is upgrade
servlet containers?)

Please post responses here, my email setup eats them.
 
P

Phil Jarvis

Any takers with some advice on this item?

Phil said:
I have a soap server running on Tomcat.
The client makes a request, and the server may have to spend some
nontrivial time formulating the response.

WHile the server formulates the response,
the client is killed by the user and the connection is (theoretically)
killed.

Is there a way to detect on the server side that the connection has been
dropped BEFORE any attempt to issue a response to the socket?

I want to get the servlet to cease and desist computation if the
socket is dropped, and if possible I'd like to detect it before my JDBC
transaction completes so I can abort a corresponding database transaction.

Right now I don't get any error until long after my transactions are
closed and the servlet has completed the response for transmission.

Thanks for any tips.

I'm using standard HttpServlet and JAXMservlet stuff on Tomcat 4.

(Does tomcat 5 automatically send some kind of interrupt to my servlet
when the connection is dropped? Maybe all I need to do is upgrade
servlet containers?)

Please post responses here, my email setup eats them.
 
S

Sudsy

Phil said:
Any takers with some advice on this item?

I haven't needed to try this but you might want to look into
SocketChannel and Selector. It would seem possible to register
interest in reading from the SocketChannel and if the remote
end "properly" closes the socket then the channel should show
as being readable but the read will return -1, indicating EOF.
I'd surmise that a tutorial on this sort of use of nio could
be found on the Sun site.
Again, not something I've needed so I don't have any boiler-
plate available.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top