Quote:
Originally Posted by spsoni
But, when I stop running server from IceGrid Admin GUI tool, my server seem to be immediately isolated from any further communication and later kill'ed (possibly by kill -9) as I cannot see debug message from CtrlCHandler from my server.
My first curiosity is, how does this "server stop" thing work from IceGrid Admin GUI or in general?
|
IceGrid stops servers by invoking the shutdown operation an the Process interface. Servers that have their adapter's RegisterProcess property set (in 3.2.1 and earlier) provide a servant that implements the Process interface. When the shutdown operation is invoked, the server deactivates itself normally by shutting down the object adapters and destroying the communicator.
IceGrid will kill the server with a signal only if it doesn't shut down within its deactivation timeout (60 seconds, by default). If the server does not have RegisterProcess set, IceGrid first tries to kill the server with SIGTERM and then, if it doesn't go away within the activation timout, sends it a SIGKILL. (Under Windows, it sends a Ctrl+Break event and, if the server does not go away after the timeout, kills the process outright.)
Quote:
|
Second, how can I configure IceGrid Admin tool to safely invoke termination of my server application(possibly by just sending Ctrl+C (i mean actual unix function call for it), but not Kill -9 equivalent unix function call.). As, I am missing async callbacks on my client, since IceGrid Admin "server stop" seem to be isolating my server appplication for any message communication first and then killing it. Please explain.
|
If you want to intercept server deactivation for your application, you can clear RegisterProcess and register a CtrlCHandler. In that case, the handler's callback will be called when the signal arrives, and you can arrange for the application to clean up from there.
As of Ice 3.3 beta, the implementation of this has changed somewhat, in particular, you can replace the default Process facet with one of your own that implements server shutdown.
See
http://www.zeroc.com/doc/Ice-3.3.0b/...rid.36.21.html and
http://www.zeroc.com/doc/Ice-3.3.0b/...18.html#124997 for more detail.
Cheers,
Michi.