aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes How should the client handle a lost connection to the server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "How should the client handle a lost connection to the server" Watch "How should the client handle a lost connection to the server" New topic
Author

How should the client handle a lost connection to the server

Paul Simon Connolly
Greenhorn

Joined: May 06, 2013
Posts: 7

Hi All,

I'm just about ready to upload my project and register for the exam, just doing final checks, and I've one remaining question at the moment.
"How should the client handle a loss in connection to the server?"

At the moment, if I kill the server and then try and search, I show an error message to the user stating that the connection has been lost and that the user will need to restart the application.
Would you say that this is good enough? Or should I have some sort of reconnection mechanism?

Kind Regards,
Paul


Certifications: OCPJP 6 (98%)
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2266
    
    3

Well, I'd say that's pretty much it.

Or should I have some sort of reconnection mechanism?


Well, since it isn't required, I wouldn't go for it.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2505
    
    8

I agree with Roberto here. No need to implement reconnection for the client.

Well for me, I did a shutdown hook for the server. If the server is going to shut down I prolong for say 2 minutes informing connected clients about the shut down.

Of course this approach will have some sort of ping test once in a while. Again this is not required.

K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How should the client handle a lost connection to the server