Archived

This forum has been archived. Please start a new discussion on GitHub.

Ice::Process

Hi,

I have an IceGrid server application that has an event loop, so it can't do a waitForShutdown(). Because of that, the server isn't stoppable using icegridadmin; it only gets killed ungracefully after some timeout period.

Looking through the documentation, I came accross B.57 Ice::Process, which states "Managed servers must implement this interface and invoke ObjectAdapter::setProcess to register the process proxy."

However, ObjectAdaper has no trace of setProcess(), if this call is appropriate in the first place..

So my question is: (how) can I be notified of imminent process shutdown by IceGrid?

Cheers,

Rob

Comments

  • benoit
    benoit Rennes, France
    Hi Rob,

    Sorry, the documentation is incorrect. There's indeed no such setProcess() method on the object adapter interface. We'll fix the documentation.

    You have several solutions to allow gracefull shutdown of your server:
    • Spawn a thread that calls communicator->waitForShutdown() and get this thread to gracefully shutdown your server once waitForShutdown() returns.
    • Implement your own Ice::Process interface (see src/Ice/ProcessI.cpp for example) to gracefully shutdown your server. You'll need to register a process object with the Ice locator registry. IceGrid will invoke the shutdown() method on your process object when necessary (e.g.: when you stop the server with the GUI or admin tool). See slice/Ice/Locator.ice for more information on the locator registry interface. You'll also find how to register the process object in the Ice source code (in the implementation of the activate() method in src/Ice/ObjectAdapterI.cpp).

    We'll look into improving the documentation regarding this!

    Benoit.