Personally I would (and did) lock the database before shutting down the server. That way you know that no other processes are in the middle of performing a write to the file.
I don't understand your concern about closing the file not checking for lock owned by clients - if you have granted the lock on the entire database, there should be no locks owned by clients.
I thought you,as a client, don't have to close the database. Method 'close' that remote client should implement was intended for closing this connection as to give the server signal that this client is out.
Originally posted by Akash Singh:
Thank You Very Much for reply.
You are right. I am trying to implement close method for server shutdown, in addition to, close method in RemoteData class.
I have ConnectionFactory, that is responsible for database startup(opening data file) and providing reference of RemoteData object to RMI client(GUI), when it is bound to RMI registry.
This close method i would like to have in ConnectionFactory class to shut down the server in nice way, means lock the database(this will wait till no client has lock), close the datafile, unbinds ConnectionFactory object.
PS. I have tried to write in detail. If you guys think, there is something something wrong in my design, please help me.
But, I still do'nt know how to destroy a registry dynamically as we create the registry using LocateRegistry.createRegistry. I am using unbind, but restarting is giving problem, when it execute createRegistry method, because old registry already exits.
Originally posted by Svetlana Koshkina:
As you can't shut down American Airlines server(right?)
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earthhttps://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter