diff options
author | Benoit Foucher <benoit@zeroc.com> | 2005-07-06 10:57:39 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2005-07-06 10:57:39 +0000 |
commit | 5dcdcde597b97f12d63c519cc6b7cb83c3820035 (patch) | |
tree | 60c0cd0779ecf7d61836ff8caf4fa3cca545dd0e /cpp/src/IceGrid/NodeI.cpp | |
parent | release reference to servant asap (diff) | |
download | ice-5dcdcde597b97f12d63c519cc6b7cb83c3820035.tar.bz2 ice-5dcdcde597b97f12d63c519cc6b7cb83c3820035.tar.xz ice-5dcdcde597b97f12d63c519cc6b7cb83c3820035.zip |
Changed server start to wait for object adapter activation before to
return.
Diffstat (limited to 'cpp/src/IceGrid/NodeI.cpp')
-rw-r--r-- | cpp/src/IceGrid/NodeI.cpp | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/cpp/src/IceGrid/NodeI.cpp b/cpp/src/IceGrid/NodeI.cpp index 90357e98f58..718afd6031b 100644 --- a/cpp/src/IceGrid/NodeI.cpp +++ b/cpp/src/IceGrid/NodeI.cpp @@ -34,6 +34,7 @@ NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter, _name(name), _hostname(IceInternal::getProtocolPluginFacade(adapter->getCommunicator())->getDefaultHost()), _proxy(proxy), + _waitTime(adapter->getCommunicator()->getProperties()->getPropertyAsIntWithDefault("IceGrid.Node.WaitTime", 60)), _serial(1) { const string dataDir = _adapter->getCommunicator()->getProperties()->getProperty("IceGrid.Node.Data"); @@ -45,7 +46,11 @@ NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter, } ServerPrx -NodeI::loadServer(const ServerDescriptorPtr& desc, StringAdapterPrxDict& adapters, const Ice::Current& current) +NodeI::loadServer(const ServerDescriptorPtr& desc, + StringAdapterPrxDict& adapters, + int& activationTimeout, + int& deactivationTimeout, + const Ice::Current& current) { Lock sync(*this); ++_serial; @@ -55,13 +60,14 @@ NodeI::loadServer(const ServerDescriptorPtr& desc, StringAdapterPrxDict& adapter id.name = desc->name; Ice::ObjectPtr servant = current.adapter->find(id); + ServerPrx proxy = ServerPrx::uncheckedCast(current.adapter->createProxy(id)); if(!servant) { - servant = new ServerI(this, _serversDir, desc->name); + servant = new ServerI(this, proxy, _serversDir, desc->name, _waitTime); current.adapter->add(servant, id); } - - ServerPrx proxy = ServerPrx::uncheckedCast(current.adapter->createProxy(id)); + activationTimeout = desc->activationTimeout > 0 ? desc->activationTimeout : _waitTime; + deactivationTimeout = desc->deactivationTimeout > 0 ? desc->deactivationTimeout : _waitTime; proxy->load(desc, adapters); return proxy; } @@ -427,38 +433,12 @@ NodeI::initObserver(const Ice::StringSeq& servers) Ice::Identity id; id.category = "IceGridServer"; id.name = *p; - if(_adapter->find(id)) + ServerIPtr server = ServerIPtr::dynamicCast(_adapter->find(id)); + if(server) { - ServerPrx proxy = ServerPrx::uncheckedCast(_adapter->createProxy(id)); try { - ServerDynamicInfo server; - server.name = *p; - server.pid = proxy->getPid(); - server.state = proxy->getState(); - if(server.state == Inactive) - { - continue; - } - serverInfos.push_back(server); - - StringAdapterPrxDict adapters = proxy->getAdapters(); - for(StringAdapterPrxDict::const_iterator p = adapters.begin(); p != adapters.end(); ++p) - { - AdapterDynamicInfo adapter; - adapter.id = p->first; - try - { - adapter.proxy = p->second->getDirectProxy(); - } - catch(const AdapterNotActiveException&) - { - } - catch(const Ice::ObjectNotExistException&) - { - } - adapterInfos.push_back(adapter); - } + server->addDynamicInfo(serverInfos, adapterInfos); } catch(const Ice::ObjectNotExistException&) { |