Soap services, tomcat servlets, detecting dropped client connection

Discussion in 'Java' started by Phil Jarvis, Jul 2, 2004.

  1. Phil Jarvis

    Phil Jarvis Guest

    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.

    --
    ----------

    Email from unknown persons will be blocked by spam filters.
    Please post replies to the new conference. Thank you.
     
    Phil Jarvis, Jul 2, 2004
    #1
    1. Advertising

  2. Phil Jarvis

    Phil Jarvis Guest

    Any takers with some advice on this item?

    Phil Jarvis wrote:
    > 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.
    >


    --
    ----------

    Email from unknown persons will be blocked by spam filters.
    Please post replies to the new conference. Thank you.
     
    Phil Jarvis, Jul 6, 2004
    #2
    1. Advertising

  3. Phil Jarvis

    Sudsy Guest

    Phil Jarvis wrote:
    > 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.
     
    Sudsy, Jul 7, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Cox
    Replies:
    2
    Views:
    2,166
    Asher Blum
    Sep 17, 2004
  2. smirks
    Replies:
    1
    Views:
    4,771
    pedroerg
    Dec 22, 2009
  3. Paul Colton

    Exception in dropped connection...

    Paul Colton, Oct 23, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    116
    Paul Colton
    Oct 23, 2003
  4. B. Deepak

    soap using remoting vs soap using web services

    B. Deepak, Jun 20, 2006, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    208
  5. Bill Atkins

    Dropped Connection Problems

    Bill Atkins, Jun 7, 2004, in forum: Ruby
    Replies:
    1
    Views:
    95
    Austin McDonald
    Jun 8, 2004
Loading...

Share This Page