diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-11-21 11:20:54 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-11-21 11:20:54 +0000 |
commit | c96825fe9e8f4d7d990a6f160608386ff8147b92 (patch) | |
tree | 4a5af766e057d84b3aeefe0beaa3351ef63480e7 /cpp/src | |
parent | Fix (diff) | |
download | ice-c96825fe9e8f4d7d990a6f160608386ff8147b92.tar.bz2 ice-c96825fe9e8f4d7d990a6f160608386ff8147b92.tar.xz ice-c96825fe9e8f4d7d990a6f160608386ff8147b92.zip |
Fix
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/IceGrid/RegistryI.cpp | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/cpp/src/IceGrid/RegistryI.cpp b/cpp/src/IceGrid/RegistryI.cpp index bc057f0dd1d..629fcc77302 100644 --- a/cpp/src/IceGrid/RegistryI.cpp +++ b/cpp/src/IceGrid/RegistryI.cpp @@ -205,10 +205,6 @@ RegistryI::start(bool nowarn) _replicaName = properties->getPropertyWithDefault("IceGrid.Registry.ReplicaName", "Master"); _master = _replicaName == "Master"; - - _reaper = new ReapThread(); - _reaper->start(); - _sessionTimeout = properties->getPropertyAsIntWithDefault("IceGrid.Registry.SessionTimeout", 30); // @@ -241,12 +237,35 @@ RegistryI::start(bool nowarn) } // - // Create the registry database. + // Ensure that nothing is running on this port. This is also + // useful to ensure that we don't run twice the same instance of + // the service too (which would cause the database environment of + // the already running instance to be "corrupted".) // + try + { + string strPrx = _instanceName + "/Locator:" + properties->getProperty("IceGrid.Registry.Client.Endpoints"); + _communicator->stringToProxy(strPrx)->ice_timeout(5000)->ice_ping(); + + Error out(_communicator->getLogger()); + out << "an IceGrid registry is already running and listening on\n"; + out << "the client endpoints `" << properties->getProperty("IceGrid.Registry.Client.Endpoints") << "'"; + return false; + } + catch(const Ice::LocalException&) + { + } + properties->setProperty("Freeze.DbEnv.Registry.DbHome", dbPath); properties->setProperty("Freeze.DbEnv.Registry.DbPrivate", "0"); // + // Create the reaper thread. + // + _reaper = new ReapThread(); + _reaper->start(); + + // // Create the internal registry object adapter. // ObjectAdapterPtr registryAdapter = _communicator->createObjectAdapter("IceGrid.Registry.Internal"); @@ -266,6 +285,9 @@ RegistryI::start(bool nowarn) "Registry"); const IceStorm::TopicManagerPrx topicManager = _iceStorm->getTopicManager(); + // + // Create the registry database. + // _database = new Database(registryAdapter, topicManager, _instanceName, _traceLevels, getInfo(), _master); _wellKnownObjects = new WellKnownObjectsManager(_database); |