File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S: Problem with stop 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 "B&S: Problem with stop server" Watch "B&S: Problem with stop server" New topic

B&S: Problem with stop server

Bodenstab Oliver
Ranch Hand

Joined: Mar 03, 2005
Posts: 47

i have a problem with stopping my server.

I've a factory who build the DatabaseImpl object. The Factory has a collection of them. If the Server-Client want to stop the server, it calls Naming.unbind and destroys all items of the collection of DatabasImpl objects by the method below. But the client can work further .
How can i destroy the DatabaseImpl objects and not only the items in the collection?

database = null doesn't work

Thanks for response


Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11778

Hi Oliver,

Have you considered going about this a totally different way? Instead of trying to stop the client calling a remote method, have your server side methods check if they are supposed to be accepting remote calls. If not, they can either block or throw some exception depending on what you consider to be a good business rule.

When you start to shut down your server, you should probably be locking the database against any write operations - this would be essential before allowing the server to stop (consider what happens if the server stops in the middle of writing a record). Setting some flag to say that remote calls are not being accepted could also be used as a flag to say that writes are no longer allowed.

Regards, Andrew

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

Joined: Mar 03, 2005
Posts: 47
Thanks for help.
I think i should go this way.

I agree. Here's the link:
subject: B&S: Problem with stop server
It's not a secret anymore!