aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Disconnecting an RMI Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Disconnecting an RMI Server" Watch "Disconnecting an RMI Server" New topic
Author

Disconnecting an RMI Server

David Sham
Ranch Hand

Joined: Apr 19, 2005
Posts: 61
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

Joined: Mar 28, 2003
Posts: 11509
    
  95

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


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
David Sham
Ranch Hand

Joined: Apr 19, 2005
Posts: 61
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Disconnecting an RMI Server