summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/IceGrid/Allocatable.cpp4
-rw-r--r--cpp/src/IceGrid/IceGridNode.cpp51
-rw-r--r--cpp/src/IceGrid/NodeI.cpp5
-rw-r--r--cpp/src/IceGrid/Topics.cpp1
4 files changed, 43 insertions, 18 deletions
diff --git a/cpp/src/IceGrid/Allocatable.cpp b/cpp/src/IceGrid/Allocatable.cpp
index 4f7dff85b83..5673ae265d2 100644
--- a/cpp/src/IceGrid/Allocatable.cpp
+++ b/cpp/src/IceGrid/Allocatable.cpp
@@ -169,7 +169,7 @@ Allocatable::allocate(const AllocationRequestPtr& request, bool fromRelease)
{
if(!_allocatable)
{
- throw NotAllocatableException("not allocatable");
+ throw AllocationException("not allocatable");
}
try
@@ -198,7 +198,7 @@ Allocatable::release(const SessionIPtr& session, bool fromRelease)
{
if(!_allocatable)
{
- throw NotAllocatableException("not allocatable");
+ throw AllocationException("not allocatable");
}
bool isReleased = false;
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)
{
diff --git a/cpp/src/IceGrid/NodeI.cpp b/cpp/src/IceGrid/NodeI.cpp
index 8d6b286aa33..779c44f547e 100644
--- a/cpp/src/IceGrid/NodeI.cpp
+++ b/cpp/src/IceGrid/NodeI.cpp
@@ -591,8 +591,11 @@ NodeI::stop()
_session->destroy();
_session = 0;
}
- catch(const Ice::LocalException&)
+ catch(const Ice::LocalException& ex)
{
+ ostringstream os;
+ os << "couldn't contact the IceGrid registry to destroy the node session:\n" << ex;
+ _traceLevels->logger->warning(os.str());
}
}
}
diff --git a/cpp/src/IceGrid/Topics.cpp b/cpp/src/IceGrid/Topics.cpp
index bf0d1395212..c91c87d3490 100644
--- a/cpp/src/IceGrid/Topics.cpp
+++ b/cpp/src/IceGrid/Topics.cpp
@@ -123,7 +123,6 @@ NodeObserverTopic::nodeDown(const string& name, const Ice::Current&)
}
}
-
void
NodeObserverTopic::updateServer(const string& node, const ServerDynamicInfo& server, const Ice::Current&)
{