GeeCON Prague 2014*
The moose likes Websphere and the fly likes Detect client disconnects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Websphere
Bookmark "Detect client disconnects" Watch "Detect client disconnects" New topic
Author

Detect client disconnects

Daniel Estevez
Greenhorn

Joined: Mar 08, 2012
Posts: 3
Hi,

I want to know when a client disconnect before get an http response.

In Tomcat for example I write on the outputstream and then make a flush, this throw an Exception that I can catch. On Websphere thi doesn't happened.

Please help, I search on docs, google and nothing...

Thank you very much!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Daniel Estevez wrote:I want to know when a client disconnect before get an http response.


Why?
Daniel Estevez
Greenhorn

Joined: Mar 08, 2012
Posts: 3
Sorry my English... is before SEND a response.

Because I need to rollback transactions in a RESTfull service if the client doesn't get a response.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

You can't tell reliably whether a client gets a response over TCP/IP and HTTP. When you send a response it goes into a buffer, from which it gets broken up into packets which are sent individually to the client and reconstructed into the response there.

In your old system you were only catching the case where the client disconnected before you flushed the output stream. There is still plenty of time after that for the client to disconnect, and you weren't catching those cases. If you need transactional reliability then TCP/IP and HTTP aren't the right tools.
Daniel Estevez
Greenhorn

Joined: Mar 08, 2012
Posts: 3
I was thinking that...

Thank you very much Paul!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Detect client disconnects