Archived

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

ICEGrid communicator stringToProxy cached, communicator shutdown immediately?

hi, everyone!
About ICEGrid, I have following questions.

Q1:Does communicator cache object of proxy?

As we all konow, call communicator->StringToProxy ("wellkonwobject") will get proxy object from ICEGrid Registry.
If I call the communicator->StringToProxy ("") five times, will communicator send request to ICEGrid Registry each time
or just sent the first request(first call of communicator->StringToProxy) to the ICEGrid Registry, then cache the proxy object.
And the four remain call of communicator->StringToProxy will no need sent requests to ICEGrid Registry.


Q2:Is there a way to shutdown communicator immediately?

In my main thread, I call communicator->WaitForShutDown(), so main thread will be blocked to get request from client.
In another thread, I call communicator->shutdown(), so main thread will exit.
But sometimes, communicator->WaitForShutDown() will hang, and the main thread will not exit.
So, Is there a way to shutdown communicator immediately?


Q3:how to recreate a communicator?

class CMyServer : public Ice::Application
{

}

void CreateApp(argc, argv)
{
CMyServer myServer;
myServer.main(argc, argv);
}

CreateApp will be called in Main Thread, and will be blocked.
In another thread, I call communicator->shutdown(), and then call CreateApp();
Is this the right way to recreate communicator?

Any help will be appreciated, Thanks.

Comments

  • benoit
    benoit Rennes, France
    Hi,

    Q1: Yes the communicator caches the result of the request by default. How long the cache entry is valid depends on the locator cache timeout, see here in the Ice manual for more information.

    Q2: The communicator waitForShutdown (after a call to shutdown) returns only once all the dispatch on your servants return. If you want to ensure the waitForShutdown method returns promptly, you have to figure out why your servant dispatch don't return quickly and look for a solution to make them return quickly.

    Q3: If you need to create multiple times the communicator within your application, I don't recommend using Ice::Application. Instead, you should manage directly the communicator creation/destruction. You can checkout the demo/Ice/minimal demo for an example of an application that manually creates/destroys the communicator.

    Cheers,
    Benoit.