File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Reconnect to server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Reconnect to server" Watch "Reconnect to server" New topic
Author

Reconnect to server

Amit Kr Kumar
Ranch Hand

Joined: Feb 08, 2002
Posts: 100
Hi team
Did anybody has provided reconnect option to the client GUI, in case server goes down while client is operating. How this can be done ??
What particular needs to be catch to detect the server has gone down???
Is it required ???

Amit
Robin Underwood
Ranch Hand

Joined: May 01, 2002
Posts: 117
I didn't provide a reconnect option. The client would get a RemoteException if the server went down, but the client would also get a RemoteException if there were network problems,...etc.
In my application the client would receive a "Server is unavailable" popup error for any RemoteException. Then both the client and server would need to be restarted.
BJ Grau
Ranch Hand

Joined: Jul 10, 2001
Posts: 234
I did the exact same thing as Robin.
I hate saying this too much because it sounds like an excuse to not do more work, but reconnecting on remote failure is outside the scope of this assignment. Your adding more unnecessary complexity to your solution which opens you up to more potential mistakes.
[ August 01, 2002: Message edited by: BJ Grau ]
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

I hate saying this too much because it sounds like an excuse to not do more work, but reconnecting on remote failure is outside the scope of this assignment. Your adding more unnecessary complexity to your solution which opens you up to more potential mistakes.

I completely agree. If you satisfy all the requirements (which do not ask for reconnects), you will get 155/155, and if you attempt to add some extra features, you might get penalised for it.
Eugene.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
I didn't allow reconnect either although I could have done it easily since I had a ServerEventService (which was also bound in the RMI registry) that ran in a background thread. There were four types of ServerEvents: startup, delayedShutdown, shutdown and heartbeat. A heartbeat was sent every 60 seconds for client confidence that the server was alive. If five heartbeats were missed, then the client assumed the server was dead. The problem with a true network failure is that in order to reconnect, you would have to "poll" the service periodically ignoring RemoteExceptions until the service came on line again. I just felt like it was better to inform the user of the stale connection and suggest that they try connecting later.
Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Sun might penalize you for "scope creep". Save yourself from the risk of the added feature, but make a mental note of it so you can cite it when later asked how the system could be (hypothetically) improved.
Disclaimer: I haven't taken the exam yet, so this is just conjecture based on other Ranch posts.
e
[ August 02, 2002: Message edited by: Erick Reid ]
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hey Eric,
Take it from me, if your design works and you can justify it, complexity is not an issue. My implementation was well beyond the scope of the assignment and I scored 154 (losing a point only on documentation). I don't suggest that anyone go to as much trouble as I did (ask my wife I was a nervous wreck the last few weeks on the assignment) but I do believe that going the extra mile will get you a higher score.
Michael Morris
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reconnect to server
 
Similar Threads
How to reset socket???
WAS on Solaris: Oracle broken pipe message
Re-Connect feature on client side.
Exception Handling
Reconnecting to Database