summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/IceGridNode.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2006-05-09 14:20:04 +0000
committerBenoit Foucher <benoit@zeroc.com>2006-05-09 14:20:04 +0000
commit3cbc6beabc2079727a70f845fc162a2072e97a02 (patch)
treec4ba2dde3970998f3137a8e4cfcf3ac1cc44da06 /cpp/src/IceGrid/IceGridNode.cpp
parentAdded identity string functions to communnicator Updated some copyright (diff)
downloadice-3cbc6beabc2079727a70f845fc162a2072e97a02.tar.bz2
ice-3cbc6beabc2079727a70f845fc162a2072e97a02.tar.xz
ice-3cbc6beabc2079727a70f845fc162a2072e97a02.zip
Cleaned up slice files, fixed IceGrid node with collocated registry warning
on shutdown.
Diffstat (limited to 'cpp/src/IceGrid/IceGridNode.cpp')
-rw-r--r--cpp/src/IceGrid/IceGridNode.cpp51
1 files changed, 37 insertions, 14 deletions
diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp
index 8f2f7ddac87..88eada0edc3 100644
--- a/cpp/src/IceGrid/IceGridNode.cpp
+++ b/cpp/src/IceGrid/IceGridNode.cpp
@@ -121,6 +121,7 @@ private:
RegistryIPtr _registry;
NodeIPtr _node;
KeepAliveThreadPtr _keepAliveThread;
+ Ice::ObjectAdapterPtr _adapter;
};
class CollocatedRegistry : public RegistryI
@@ -392,7 +393,7 @@ NodeService::start(int argc, char* argv[])
//
properties->setProperty("IceGrid.Node.RegisterProcess", "0");
properties->setProperty("IceGrid.Node.AdapterId", "");
- ObjectAdapterPtr adapter = communicator()->createObjectAdapter("IceGrid.Node");
+ _adapter = communicator()->createObjectAdapter("IceGrid.Node");
//
// Create the wait queue.
@@ -406,9 +407,9 @@ NodeService::start(int argc, char* argv[])
// evictors and object factories necessary to store these objects.
//
Identity id = communicator()->stringToIdentity(IceUtil::generateUUID());
- NodePrx nodeProxy = NodePrx::uncheckedCast(adapter->createProxy(id));
- _node = new NodeI(adapter, _activator, _waitQueue, traceLevels, nodeProxy, name);
- adapter->add(_node, nodeProxy->ice_getIdentity());
+ NodePrx nodeProxy = NodePrx::uncheckedCast(_adapter->createProxy(id));
+ _node = new NodeI(_adapter, _activator, _waitQueue, traceLevels, nodeProxy, name);
+ _adapter->add(_node, nodeProxy->ice_getIdentity());
//
// Start the keep alive thread. By default we start the thread
@@ -426,7 +427,7 @@ NodeService::start(int argc, char* argv[])
{
try
{
- ProcessPrx proxy = ProcessPrx::uncheckedCast(adapter->addWithUUID(new ProcessI(_activator)));
+ ProcessPrx proxy = ProcessPrx::uncheckedCast(_adapter->addWithUUID(new ProcessI(_activator)));
LocatorRegistryPrx locatorRegistry = communicator()->getDefaultLocator()->getRegistry();
locatorRegistry->setServerProcessProxy(properties->getProperty("Ice.ServerId"), proxy);
}
@@ -446,7 +447,7 @@ NodeService::start(int argc, char* argv[])
//
// Activate the adapter.
//
- adapter->activate();
+ _adapter->activate();
//
// Deploy application if a descriptor is passed as a command-line option.
@@ -551,26 +552,48 @@ NodeService::stop()
_keepAliveThread = 0;
}
+ _activator = 0;
+
//
- // We can now safely shutdown the communicator.
+ // Deactivate the node object adapter.
//
try
{
- communicator()->shutdown();
- communicator()->waitForShutdown();
+ _adapter->deactivate();
+ _adapter->waitForDeactivate();
+ _adapter = 0;
}
- catch(...)
+ catch(const Ice::LocalException& ex)
{
- assert(false);
+ ostringstream ostr;
+ ostr << "unexpected exception while shutting down node:\n" << ex;
+ warning(ostr.str());
}
- _activator = 0;
-
+ //
+ // Stop the node (this unregister the node session with the
+ // registry.)
+ //
_node->stop();
_node = 0;
//
- // Shutdown the collocated registry.
+ // We can now safely shutdown the communicator.
+ //
+ try
+ {
+ communicator()->shutdown();
+ communicator()->waitForShutdown();
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ ostringstream ostr;
+ ostr << "unexpected exception while shutting down node:\n" << ex;
+ warning(ostr.str());
+ }
+
+ //
+ // And shutdown the collocated registry.
//
if(_registry)
{