summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2005-03-29 10:56:16 +0000
committerBenoit Foucher <benoit@zeroc.com>2005-03-29 10:56:16 +0000
commit1cc7d506ebd4a70e77f345c1b2acf369788097a6 (patch)
tree185dad93cffd6a525067559e6915566395bd1714
parentFix (diff)
downloadice-1cc7d506ebd4a70e77f345c1b2acf369788097a6.tar.bz2
ice-1cc7d506ebd4a70e77f345c1b2acf369788097a6.tar.xz
ice-1cc7d506ebd4a70e77f345c1b2acf369788097a6.zip
Fixed shutdown bug.
-rw-r--r--cpp/src/IcePack/AdminI.cpp9
-rw-r--r--cpp/src/IcePack/AdminI.h7
-rw-r--r--cpp/src/IcePack/IcePackNode.cpp42
-rw-r--r--cpp/src/IcePack/IcePackRegistry.cpp4
-rw-r--r--cpp/src/IcePack/Registry.cpp15
-rw-r--r--cpp/src/IcePack/Registry.h5
6 files changed, 62 insertions, 20 deletions
diff --git a/cpp/src/IcePack/AdminI.cpp b/cpp/src/IcePack/AdminI.cpp
index a94047e1193..c582b5f0c29 100644
--- a/cpp/src/IcePack/AdminI.cpp
+++ b/cpp/src/IcePack/AdminI.cpp
@@ -11,6 +11,7 @@
#include <IcePack/AdminI.h>
#include <IcePack/DescriptorVisitor.h>
#include <IcePack/DescriptorUtil.h>
+#include <IcePack/Registry.h>
#include <Ice/LoggerUtil.h>
#include <Ice/TraceUtil.h>
#include <Ice/SliceChecksums.h>
@@ -1034,13 +1035,15 @@ AdminI::AdminI(const CommunicatorPtr& communicator,
const ApplicationRegistryPtr& applicationRegistry,
const ServerRegistryPtr& serverRegistry,
const AdapterRegistryPtr& adapterRegistry,
- const ObjectRegistryPtr& objectRegistry) :
+ const ObjectRegistryPtr& objectRegistry,
+ const RegistryPtr& registry) :
_communicator(communicator),
_nodeRegistry(nodeRegistry),
_applicationRegistry(applicationRegistry),
_serverRegistry(serverRegistry),
_adapterRegistry(adapterRegistry),
- _objectRegistry(objectRegistry)
+ _objectRegistry(objectRegistry),
+ _registry(registry)
{
}
@@ -1517,7 +1520,7 @@ AdminI::getAllNodeNames(const Current&) const
void
AdminI::shutdown(const Current&)
{
- _communicator->shutdown();
+ _registry->shutdown();
}
SliceChecksumDict
diff --git a/cpp/src/IcePack/AdminI.h b/cpp/src/IcePack/AdminI.h
index 161c8070f80..68f82e9f148 100644
--- a/cpp/src/IcePack/AdminI.h
+++ b/cpp/src/IcePack/AdminI.h
@@ -15,12 +15,16 @@
namespace IcePack
{
+class Registry;
+typedef IceUtil::Handle<Registry> RegistryPtr;
+
class AdminI : public Admin, public IceUtil::Mutex
{
public:
AdminI(const Ice::CommunicatorPtr&, const NodeRegistryPtr&, const ApplicationRegistryPtr&,
- const ServerRegistryPtr&, const AdapterRegistryPtr&, const ObjectRegistryPtr&);
+ const ServerRegistryPtr&, const AdapterRegistryPtr&, const ObjectRegistryPtr&,
+ const RegistryPtr&);
virtual ~AdminI();
virtual void addApplication(const ApplicationDescriptorPtr&, const Ice::Current&);
@@ -71,6 +75,7 @@ private:
ServerRegistryPtr _serverRegistry;
AdapterRegistryPtr _adapterRegistry;
ObjectRegistryPtr _objectRegistry;
+ RegistryPtr _registry;
};
}
diff --git a/cpp/src/IcePack/IcePackNode.cpp b/cpp/src/IcePack/IcePackNode.cpp
index c5e73dcee26..d51ffc9a99f 100644
--- a/cpp/src/IcePack/IcePackNode.cpp
+++ b/cpp/src/IcePack/IcePackNode.cpp
@@ -63,7 +63,19 @@ private:
ActivatorPtr _activator;
WaitQueuePtr _waitQueue;
- std::auto_ptr<Registry> _registry;
+ RegistryPtr _registry;
+};
+
+class CollocatedRegistry : public Registry
+{
+public:
+
+ CollocatedRegistry(const Ice::CommunicatorPtr&, const ActivatorPtr&);
+ virtual void shutdown();
+
+private:
+
+ ActivatorPtr _activator;
};
} // End of namespace IcePack
@@ -97,6 +109,18 @@ childHandler(int)
}
#endif
+CollocatedRegistry::CollocatedRegistry(const Ice::CommunicatorPtr& communicator, const ActivatorPtr& activator) :
+ Registry(communicator),
+ _activator(activator)
+{
+}
+
+void
+CollocatedRegistry::shutdown()
+{
+ _activator->shutdown();
+}
+
IcePack::NodeService::NodeService()
{
}
@@ -184,6 +208,12 @@ IcePack::NodeService::start(int argc, char* argv[])
}
//
+ // Create the activator.
+ //
+ TraceLevelsPtr traceLevels = new TraceLevels(properties, communicator()->getLogger());
+ _activator = new Activator(traceLevels, properties);
+
+ //
// Collocate the IcePack registry if we need to.
//
if(properties->getPropertyAsInt("IcePack.Node.CollocateRegistry") > 0)
@@ -204,7 +234,7 @@ IcePack::NodeService::start(int argc, char* argv[])
properties->setProperty("Ice.ThreadPool.Server.Size", os2.str());
}
- _registry = auto_ptr<Registry>(new Registry(communicator()));
+ _registry = new CollocatedRegistry(communicator(), _activator);
if(!_registry->start(nowarn))
{
return false;
@@ -323,6 +353,7 @@ IcePack::NodeService::start(int argc, char* argv[])
{
warning("property `IcePack.Node.Name' is not set, using hostname: " + string(host));
}
+ properties->setProperty("IcePack.Node.Name", string(host));
}
//
@@ -337,13 +368,6 @@ IcePack::NodeService::start(int argc, char* argv[])
properties->setProperty("IcePack.Node.AdapterId", "IcePack.Node." + name);
ObjectAdapterPtr adapter = communicator()->createObjectAdapter("IcePack.Node");
- TraceLevelsPtr traceLevels = new TraceLevels(properties, communicator()->getLogger());
-
- //
- // Create the activator.
- //
- _activator = new Activator(traceLevels, properties);
-
//
// Create the wait queue.
//
diff --git a/cpp/src/IcePack/IcePackRegistry.cpp b/cpp/src/IcePack/IcePackRegistry.cpp
index 47dd0611130..49f511530ad 100644
--- a/cpp/src/IcePack/IcePackRegistry.cpp
+++ b/cpp/src/IcePack/IcePackRegistry.cpp
@@ -34,7 +34,7 @@ private:
void usage(const std::string&);
- std::auto_ptr<Registry> _registry;
+ RegistryPtr _registry;
};
} // End of namespace IcePack
@@ -83,7 +83,7 @@ IcePack::RegistryService::start(int argc, char* argv[])
return false;
}
- _registry = auto_ptr<Registry>(new Registry(communicator()));
+ _registry = new Registry(communicator());
if(!_registry->start(nowarn))
{
return false;
diff --git a/cpp/src/IcePack/Registry.cpp b/cpp/src/IcePack/Registry.cpp
index 124e69ca769..0ac4689fdfe 100644
--- a/cpp/src/IcePack/Registry.cpp
+++ b/cpp/src/IcePack/Registry.cpp
@@ -48,17 +48,17 @@ intToString(int v)
return os.str();
}
-IcePack::Registry::Registry(const CommunicatorPtr& communicator) :
+Registry::Registry(const CommunicatorPtr& communicator) :
_communicator(communicator)
{
}
-IcePack::Registry::~Registry()
+Registry::~Registry()
{
}
bool
-IcePack::Registry::start(bool nowarn)
+Registry::start(bool nowarn)
{
assert(_communicator);
PropertiesPtr properties = _communicator->getProperties();
@@ -266,7 +266,8 @@ IcePack::Registry::start(bool nowarn)
//
// Create the admin interface and register it with the object registry.
//
- ObjectPtr admin = new AdminI(_communicator, nodeReg, appReg, serverRegistry, adapterRegistry, objectRegistry);
+ ObjectPtr admin = new AdminI(_communicator, nodeReg, appReg, serverRegistry, adapterRegistry, objectRegistry,
+ this);
adminAdapter->add(admin, stringToIdentity("IcePack/Admin"));
ObjectPrx adminPrx = adminAdapter->createDirectProxy(stringToIdentity("IcePack/Admin"));
try
@@ -317,3 +318,9 @@ IcePack::Registry::start(bool nowarn)
return true;
}
+
+void
+Registry::shutdown()
+{
+ _communicator->shutdown();
+}
diff --git a/cpp/src/IcePack/Registry.h b/cpp/src/IcePack/Registry.h
index 418fad65c9a..341c840f41c 100644
--- a/cpp/src/IcePack/Registry.h
+++ b/cpp/src/IcePack/Registry.h
@@ -13,7 +13,7 @@
namespace IcePack
{
-class Registry
+class Registry : public IceUtil::Shared
{
public:
@@ -22,10 +22,13 @@ public:
bool start(bool);
+ virtual void shutdown();
+
private:
Ice::CommunicatorPtr _communicator;
};
+typedef IceUtil::Handle<Registry> RegistryPtr;
}