Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What happens when there is an error with the server?

 
Min Huang
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose I am exposing the DB interface to the client and the client requests a read from the server. Suppose during the read, an IOException is raised. How should the server gracefully exit in this case? How would the client know what's going on?
 
Ricardo Estafan
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Give a Message box that the server is down? Perhaps use JOptionPane.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Min,
If you do a search in this forum for the word IOException in the subject line, you will get around 18 threads you can read about this problem.
It would be a good idea to let the client's know that there was a problem - you can do that by wrapping the IOException in your own runtime exception.
Note that unless you implement a two way RMI solution (so the server can call methods on the client - possibly by using the Observer/Observable design pattern), you will not be able to notify all clients that there was a problem. Doing so would be a nice idea in the real world, but I think it is well outside of scope for this assignment (but you might want to mention that you thought of it in your design decisions ).
I believe it is essential that you log the exception (even if only to screen) with as much information as possible so that there is the possibility that someone can debug the problem later.
Regards, Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic