• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Disconnecting an RMI Server

 
David Sham
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My RMI Server has a reference to my Remote implementation which contains the database reference. I want to stop my server without shutting down the server application, and be able to start the server again perhaps with a different database file location.

Should I do this by just setting my remote implementation reference to null? I imagine that would kill any open connections to any clients. Does that sound right, or is there a better way?

Thanks for any input.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David,

I believe that this is not required for certification, so you might be better leaving it out.

From my reading of your post, it sounds like the remote client will still be able to connect to your server and call your methods while the database is disconnected - presumably you would throw some exception you created at that point to let the client know that the server is temporarily offline.

So (again, from my reading of your post) I think you will not be killing any open connections, but instead you will stop them from performing real operations until the new database is connected.

Of course I could have misread your post.

Regards, Andrew
 
David Sham
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andrew,
Thanks for your reply. Yes I have decided to leave this functionality out. Once the server is started, the user can kill it by pressing ctrl-c at the command prompt. That should be sufficient.

But you brought up a good point - that if the server is down, or rather if the database connection the server has is down, then the clients accessing the server must be notified that this is the case whenever they request data from the server. Good point. I hadn't thought of that. Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic