I am thinking of shutting down the server properly, but haven't got a good idea yet.2. Ctrl-C is OK for closing the server. Some of us created Server GUIs, but that is not a requirement for closing the server. However, you still need to have code to lock all the records if "-1" is passed to the lock method.
Peter
Jacques<br />*******<br />MCP, SCJP, SCJD, SCWCD
Jacques<br />*******<br />MCP, SCJP, SCJD, SCWCD
Peter
Removes the remote object, obj, from the RMI runtime. If successful, the object can no longer accept incoming RMI calls. If the force parameter is true, the object is forcibly unexported even if there are pending calls to the remote object or the remote object still has calls in progress. If the force parameter is false, the object is only unexported if there are no pending or in progress calls to the object.
A much easier approach would be to use UnicastRemoteObject.unexport().
[...]
That sounds promising. You call unexport(myObject, )false) and the RMI runtime will take care of the rest. Is it as easy as that?
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Naming.unbind would not prohibit current clients from sending requests.
Originally posted by Marcel St�r:
Hi,
I've given the "proper shutdown" problem quite some thought - I believe;-)
What I do is the following:unbind the RMI object (or close the socket.accept thread) so that no new requests will get through. ask the db to shut itself down. It makes sure all pending request are completed (internally keeping track of them) and then closes the data file. call UnicastRemoteObject.unexportObject for the registry which was started by the server.start method.
This procedure allows me to start/stop the server in the server's admin GUI without terminating the program.
Regards,
Marcel
P.S. if someone has found a better solution to shutdown the RMI registry, please let me know...
1. lockdatabase
2. close database
3. unbind registry
Originally posted by Marcel St�r:
Gytis,
I have my server wait for 60 seconds. Should perhaps be configurable through the properties file and GUI...
Regards,
Marcel
Calling lock(-1) will wait for all clients to release their locks, and therefore all pending transactions are already finished.
Originally posted by Gytis Jakutonis:
Mark,
But lock(-1) may block for e.g. 30 minutes if client holding lock has died or even block forever if malicious client holds lock without releasing it.
Originally posted by Gytis Jakutonis:
Mark,
But lock(-1) may block for e.g. 30 minutes if client holding lock has died or even block forever if malicious client holds lock without releasing it.
Proudly marching to the beat of a different kettle of fish... while reading this tiny ad
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|