diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/CommunicatorI.cpp | 5 | ||||
-rw-r--r-- | cpp/src/Ice/CommunicatorI.h | 1 | ||||
-rw-r--r-- | cpp/src/Ice/Instance.cpp | 367 | ||||
-rw-r--r-- | cpp/src/Ice/Instance.h | 6 | ||||
-rw-r--r-- | cpp/src/Ice/LoggerAdminI.cpp | 8 | ||||
-rw-r--r-- | cpp/src/Ice/LoggerAdminI.h | 5 | ||||
-rw-r--r-- | cpp/src/Ice/ObjectAdapterI.cpp | 20 | ||||
-rw-r--r-- | cpp/src/Ice/ObjectAdapterI.h | 1 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.cpp | 3 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.h | 2 | ||||
-rw-r--r-- | cpp/src/IceBox/ServiceManagerI.cpp | 20 |
11 files changed, 289 insertions, 149 deletions
diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp index 7f225c425e0..498f7c126f3 100644 --- a/cpp/src/Ice/CommunicatorI.cpp +++ b/cpp/src/Ice/CommunicatorI.cpp @@ -301,6 +301,11 @@ Ice::CommunicatorI::end_flushBatchRequests(const AsyncResultPtr& r) } ObjectPrx +Ice::CommunicatorI::createAdmin(const ObjectAdapterPtr& adminAdapter, const Identity& adminId) +{ + return _instance->createAdmin(adminAdapter, adminId); +} +ObjectPrx Ice::CommunicatorI::getAdmin() const { return _instance->getAdmin(); diff --git a/cpp/src/Ice/CommunicatorI.h b/cpp/src/Ice/CommunicatorI.h index 3aa27681465..4c7bb43f13b 100644 --- a/cpp/src/Ice/CommunicatorI.h +++ b/cpp/src/Ice/CommunicatorI.h @@ -73,6 +73,7 @@ public: virtual void end_flushBatchRequests(const AsyncResultPtr&); + virtual ObjectPrx createAdmin(const ObjectAdapterPtr&, const Identity&); virtual ObjectPrx getAdmin() const; virtual void addAdminFacet(const ObjectPtr&, const std::string&); virtual ObjectPtr removeAdminFacet(const std::string&); diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index eb2e998a74b..2bf9555f237 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -590,143 +590,223 @@ IceInternal::Instance::identityToString(const Identity& ident) const } Ice::ObjectPrx -IceInternal::Instance::getAdmin() +IceInternal::Instance::createAdmin(const ObjectAdapterPtr& adminAdapter, const Identity& adminIdentity) { + ObjectAdapterPtr adapter = adminAdapter; + bool createAdapter = !adminAdapter; + IceUtil::RecMutex::Lock sync(*this); - + if(_state == StateDestroyed) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } - const string adminOA = "Ice.Admin"; - - if(_adminAdapter != 0) + if(adminIdentity.name.empty()) { - return _adminAdapter->createProxy(_adminIdentity); + throw Ice::IllegalIdentityException(__FILE__, __LINE__, adminIdentity); } - else if(_initData.properties->getProperty(adminOA + ".Endpoints") == "") + + if(_adminAdapter) { - return 0; + throw InitializationException(__FILE__, __LINE__, "Admin already created"); } - else + + if(!_adminEnabled) { - string serverId = _initData.properties->getProperty("Ice.Admin.ServerId"); - string instanceName = _initData.properties->getProperty("Ice.Admin.InstanceName"); - - Ice::LocatorPrx defaultLocator = _referenceFactory->getDefaultLocator(); - if((defaultLocator != 0 && serverId != "") || instanceName != "") + throw InitializationException(__FILE__, __LINE__, "Admin is disabled"); + } + + if(createAdapter) + { + if(_initData.properties->getProperty("Ice.Admin.Endpoints") != "") { - if(_adminIdentity.name == "") - { - _adminIdentity.name = "admin"; - if(instanceName == "") - { - instanceName = IceUtil::generateUUID(); - } - _adminIdentity.category = instanceName; - - // - // Afterwards, _adminIdentity is read-only - // - } + adapter = _objectAdapterFactory->createObjectAdapter("Ice.Admin", 0); + } + else + { + throw InitializationException(__FILE__, __LINE__, "Ice.Admin.Endpoints is not set"); + } + } + _adminIdentity = adminIdentity; + _adminAdapter = adapter; + addAllAdminFacets(); + sync.release(); + + if(createAdapter) + { + try + { + adapter->activate(); + } + catch(...) + { // - // Create OA + // We clean it up, even through this error is not recoverable + // (can't call again createAdmin after fixing the problem since all the facets + // in the adapter are lost) // - _adminAdapter = _objectAdapterFactory->createObjectAdapter(adminOA, 0); + adapter->destroy(); + sync.acquire(); + _adminAdapter = 0; + throw; + } + } + setServerProcessProxy(adapter, adminIdentity); + return adapter->createProxy(adminIdentity); +} +Ice::ObjectPrx +IceInternal::Instance::getAdmin() +{ + IceUtil::RecMutex::Lock sync(*this); + + if(_state == StateDestroyed) + { + throw CommunicatorDestroyedException(__FILE__, __LINE__); + } + + if(_adminAdapter) + { + return _adminAdapter->createProxy(_adminIdentity); + } + else if(_adminEnabled) + { + ObjectAdapterPtr adapter; + if(getAdminEnabledDefaultValue()) + { + adapter = _objectAdapterFactory->createObjectAdapter("Ice.Admin", 0); + } + else + { + return 0; + } + + Identity adminIdentity; + adminIdentity.name = "admin"; + adminIdentity.category = _initData.properties->getProperty("Ice.Admin.InstanceName"); + if(adminIdentity.category.empty()) + { + adminIdentity.category = IceUtil::generateUUID(); + } + + _adminIdentity = adminIdentity; + _adminAdapter = adapter; + addAllAdminFacets(); + sync.release(); + try + { + adapter->activate(); + } + catch(...) + { // - // Add all facets to OA + // We clean it up, even through this error is not recoverable + // (can't call again createAdmin after fixing the problem since all the facets + // in the adapter are lost) // - FacetMap filteredFacets; + adapter->destroy(); + sync.acquire(); + _adminAdapter = 0; + throw; + } - for(FacetMap::iterator p = _adminFacets.begin(); p != _adminFacets.end(); ++p) - { - if(_adminFacetFilter.empty() || _adminFacetFilter.find(p->first) != _adminFacetFilter.end()) - { - _adminAdapter->addFacet(p->second, _adminIdentity, p->first); - } - else - { - filteredFacets[p->first] = p->second; - } - } - _adminFacets.swap(filteredFacets); + setServerProcessProxy(adapter, adminIdentity); + return adapter->createProxy(adminIdentity); + } + else + { + return 0; + } +} - ObjectAdapterPtr adapter = _adminAdapter; - sync.release(); +void +IceInternal::Instance::addAllAdminFacets() +{ + // must be called with this locked + + // + // Add all facets to OA + // + FacetMap filteredFacets; + + for(FacetMap::iterator p = _adminFacets.begin(); p != _adminFacets.end(); ++p) + { + if(_adminFacetFilter.empty() || _adminFacetFilter.find(p->first) != _adminFacetFilter.end()) + { + _adminAdapter->addFacet(p->second, _adminIdentity, p->first); + } + else + { + filteredFacets[p->first] = p->second; + } + } + _adminFacets.swap(filteredFacets); +} +void +IceInternal::Instance::setServerProcessProxy(const ObjectAdapterPtr& adminAdapter, const Identity& adminIdentity) +{ + ObjectPrx admin = adminAdapter->createProxy(adminIdentity); + LocatorPrx locator = adminAdapter->getLocator(); + const string serverId = _initData.properties->getProperty("Ice.Admin.ServerId"); + + if(locator && serverId != "") + { + ProcessPrx process = ProcessPrx::uncheckedCast(admin->ice_facet("Process")); + try + { // - // Activate OA + // Note that as soon as the process proxy is registered, the communicator might be + // shutdown by a remote client and admin facets might start receiving calls. // - try - { - adapter->activate(); - } - catch(...) - { - // - // We cleanup _adminAdapter, however this error is not recoverable - // (can't call again getAdmin() after fixing the problem) - // since all the facets (servants) in the adapter are lost - // - adapter->destroy(); - sync.acquire(); - _adminAdapter = 0; - throw; - } - - Ice::ObjectPrx admin = adapter->createProxy(_adminIdentity); - if(defaultLocator != 0 && serverId != "") + locator->getRegistry()->setServerProcessProxy(serverId, process); + } + catch(const ServerNotFoundException&) + { + if(_traceLevels->location >= 1) { - ProcessPrx process = ProcessPrx::uncheckedCast(admin->ice_facet("Process")); - try - { - // - // Note that as soon as the process proxy is registered, the communicator might be - // shutdown by a remote client and admin facets might start receiving calls. - // - defaultLocator->getRegistry()->setServerProcessProxy(serverId, process); - } - catch(const ServerNotFoundException&) - { - if(_traceLevels->location >= 1) - { - Trace out(_initData.logger, _traceLevels->locationCat); - out << "couldn't register server `" + serverId + "' with the locator registry:\n"; - out << "the server is not known to the locator registry"; - } - - throw InitializationException(__FILE__, __LINE__, "Locator knows nothing about server '" + - serverId + "'"); - } - catch(const LocalException& ex) - { - if(_traceLevels->location >= 1) - { - Trace out(_initData.logger, _traceLevels->locationCat); - out << "couldn't register server `" + serverId + "' with the locator registry:\n" << ex; - } - throw; - } + Trace out(_initData.logger, _traceLevels->locationCat); + out << "couldn't register server `" + serverId + "' with the locator registry:\n"; + out << "the server is not known to the locator registry"; } - + + throw InitializationException(__FILE__, __LINE__, "Locator knows nothing about server `" + + serverId + "'"); + } + catch(const LocalException& ex) + { if(_traceLevels->location >= 1) { Trace out(_initData.logger, _traceLevels->locationCat); - out << "registered server `" + serverId + "' with the locator registry"; + out << "couldn't register server `" + serverId + "' with the locator registry:\n" << ex; } - - return admin; + throw; } - else + + if(_traceLevels->location >= 1) { - return 0; + Trace out(_initData.logger, _traceLevels->locationCat); + out << "registered server `" + serverId + "' with the locator registry"; } } } +bool +IceInternal::Instance::getAdminEnabledDefaultValue() const +{ + // must be called with this locked or during single-threaded initialization + + const Ice::PropertiesPtr& props = _initData.properties; + + return props->getProperty("Ice.Admin.Endpoints") != "" && + (props->getProperty("Ice.Admin.InstanceName") != "" || (props->getProperty("Ice.Admin.ServerId") != "" && + (_referenceFactory->getDefaultLocator() || + props->getProperty("Ice.Default.Locator") != ""))); +} + + void IceInternal::Instance::addAdminFacet(const Ice::ObjectPtr& servant, const string& facet) { @@ -894,7 +974,8 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi _collectObjects(false), _implicitContext(0), _stringConverter(IceUtil::getProcessStringConverter()), - _wstringConverter(IceUtil::getProcessWstringConverter()) + _wstringConverter(IceUtil::getProcessWstringConverter()), + _adminEnabled(false) { try { @@ -1277,63 +1358,83 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[], const Ice::Communica pluginManagerImpl->loadPlugins(argc, argv); // - // Add admin facets + // Create Admin facets, if enabled. + // // Note that any logger-dependent admin facet must be created after we load all plugins, // since one of these plugins can be a Logger plugin that sets a new logger during loading // - StringSeq facetSeq = _initData.properties->getPropertyAsList("Ice.Admin.Facets"); - - if(!facetSeq.empty()) + if(_initData.properties->getProperty("Ice.Admin.Enabled") == "") { - _adminFacetFilter.insert(facetSeq.begin(), facetSeq.end()); + _adminEnabled = getAdminEnabledDefaultValue(); + } + else + { + _adminEnabled = _initData.properties->getPropertyAsInt("Ice.Admin.Enabled") > 0; } - _adminFacets.insert(FacetMap::value_type("Process", new ProcessI(communicator))); - string loggerFacetName = _initData.properties->getPropertyWithDefault("Ice.Admin.Logger", "Logger"); + if(_adminEnabled) + { + StringSeq facetSeq = _initData.properties->getPropertyAsList("Ice.Admin.Facets"); + + if(!facetSeq.empty()) + { + _adminFacetFilter.insert(facetSeq.begin(), facetSeq.end()); + } + } - bool insertLoggerFacet = - (_adminFacetFilter.empty() || _adminFacetFilter.find(loggerFacetName) != _adminFacetFilter.end()) && - _initData.properties->getProperty("Ice.Admin.Endpoints") != ""; + const string loggerFacetName = _initData.properties->getPropertyWithDefault("Ice.Admin.Logger", "Logger"); + + // If it's the default value (Logger), we check that _adminEnabled is true and the facet is not + // filtered out; otherwise, we create and register the new Logger unconditionally, as its + // associated Admin facet will be registered with a different communicator. + // + bool addLoggerFacet = _adminEnabled && + (_adminFacetFilter.empty() || _adminFacetFilter.find(loggerFacetName) != _adminFacetFilter.end()); - if(loggerFacetName != "Logger" || insertLoggerFacet) + if(loggerFacetName != "Logger" || addLoggerFacet) { // // Set up a new Logger // - Ice::LoggerAdminLoggerPtr logger = createLoggerAdminLogger(loggerFacetName, - _initData.properties, + Ice::LoggerAdminLoggerPtr logger = createLoggerAdminLogger(loggerFacetName, _initData.properties, _initData.logger); setLogger(logger); - - if(insertLoggerFacet) + + if(addLoggerFacet) { - logger->addAdminFacet(communicator); + _adminFacets.insert(make_pair(loggerFacetName, logger->getFacet())); } // - // Else, this new logger & facet is useful for "slave" communicators like IceBox services. + // Else, this new logger & facet are useful for "slave" communicators like IceBox services. // } - PropertiesAdminIPtr props = new PropertiesAdminI("Properties", _initData.properties, _initData.logger); - _adminFacets.insert(FacetMap::value_type("Properties", props)); + PropertiesAdminIPtr propsAdmin; - _metricsAdmin = new MetricsAdminI(_initData.properties, _initData.logger); - _adminFacets.insert(FacetMap::value_type("Metrics", _metricsAdmin)); + if(_adminEnabled) + { + _adminFacets.insert(FacetMap::value_type("Process", new ProcessI(communicator))); + + propsAdmin = new PropertiesAdminI("Properties", _initData.properties, _initData.logger); + _adminFacets.insert(FacetMap::value_type("Properties", propsAdmin)); + _metricsAdmin = new MetricsAdminI(_initData.properties, _initData.logger); + _adminFacets.insert(FacetMap::value_type("Metrics", _metricsAdmin)); + } + // // Setup the communicator observer only if the user didn't already set an - // Ice observer resolver and if the admininistrative endpoints are set. + // Ice observer resolver and Admin is enabled // - if((_adminFacetFilter.empty() || _adminFacetFilter.find("Metrics") != _adminFacetFilter.end()) && - _initData.properties->getProperty("Ice.Admin.Endpoints") != "") + if(_adminEnabled && (_adminFacetFilter.empty() || _adminFacetFilter.find("Metrics") != _adminFacetFilter.end())) { _observer = new CommunicatorObserverI(_metricsAdmin, _initData.observer); - + // // Make sure the admin plugin receives property updates. // - props->addUpdateCallback(_metricsAdmin); + propsAdmin->addUpdateCallback(_metricsAdmin); } else { @@ -1347,7 +1448,7 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[], const Ice::Communica { _observer->setObserverUpdater(new ObserverUpdaterI(this)); } - + // // Create threads. // @@ -1445,9 +1546,13 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[], const Ice::Communica // // This must be done last as this call creates the Ice.Admin object adapter // and eventually register a process proxy with the Ice locator (allowing - // remote clients to invoke on Ice.Admin facets as soon as it's registered). + // remote clients to invoke Admin facets as soon as it's registered). // - if(_initData.properties->getPropertyAsIntWithDefault("Ice.Admin.DelayCreation", 0) <= 0) + // Note: getAdmin here can return 0 and do nothing in the event the + // application set Ice.Admin.Enabled but did not set Ice.Admin.Enpoints + // and one or more of the properties required to create the Admin object. + // + if(_adminEnabled && _initData.properties->getPropertyAsIntWithDefault("Ice.Admin.DelayCreation", 0) <= 0) { getAdmin(); } diff --git a/cpp/src/Ice/Instance.h b/cpp/src/Ice/Instance.h index e9806b307a6..19bfda51f89 100644 --- a/cpp/src/Ice/Instance.h +++ b/cpp/src/Ice/Instance.h @@ -89,6 +89,7 @@ public: Ice::Identity stringToIdentity(const std::string&) const; std::string identityToString(const Ice::Identity&) const; + Ice::ObjectPrx createAdmin(const Ice::ObjectAdapterPtr&, const Ice::Identity&); Ice::ObjectPrx getAdmin(); void addAdminFacet(const Ice::ObjectPtr&, const std::string&); Ice::ObjectPtr removeAdminFacet(const std::string&); @@ -128,6 +129,10 @@ private: void updateThreadObservers(); friend class ObserverUpdaterI; + void addAllAdminFacets(); + void setServerProcessProxy(const Ice::ObjectAdapterPtr&, const Ice::Identity&); + bool getAdminEnabledDefaultValue() const; + enum State { StateActive, @@ -163,6 +168,7 @@ private: const Ice::ImplicitContextIPtr _implicitContext; IceUtil::StringConverterPtr _stringConverter; IceUtil::WstringConverterPtr _wstringConverter; + bool _adminEnabled; Ice::ObjectAdapterPtr _adminAdapter; Ice::FacetMap _adminFacets; Ice::Identity _adminIdentity; diff --git a/cpp/src/Ice/LoggerAdminI.cpp b/cpp/src/Ice/LoggerAdminI.cpp index 7d71c5556a3..3a59d2e7880 100644 --- a/cpp/src/Ice/LoggerAdminI.cpp +++ b/cpp/src/Ice/LoggerAdminI.cpp @@ -152,7 +152,7 @@ public: virtual std::string getPrefix(); virtual LoggerPtr cloneWithPrefix(const std::string&); - virtual void addAdminFacet(const CommunicatorPtr&); + virtual ObjectPtr getFacet() const; virtual void destroy(); const LoggerPtr& getLocalLogger() const @@ -665,10 +665,10 @@ LoggerAdminLoggerI::cloneWithPrefix(const string& prefix) return _localLogger->cloneWithPrefix(prefix); } -void -LoggerAdminLoggerI::addAdminFacet(const CommunicatorPtr& communicator) +ObjectPtr +LoggerAdminLoggerI::getFacet() const { - communicator->addAdminFacet(_loggerAdmin, _loggerAdmin->getFacetName()); + return _loggerAdmin; } void diff --git a/cpp/src/Ice/LoggerAdminI.h b/cpp/src/Ice/LoggerAdminI.h index 1a175d1b8ff..57991888f18 100644 --- a/cpp/src/Ice/LoggerAdminI.h +++ b/cpp/src/Ice/LoggerAdminI.h @@ -26,10 +26,9 @@ class ICE_API LoggerAdminLogger : public Ice::Logger public: // - // Add the associated LoggerAdmin facet to this communicator + // Return the associated Admin facet // - virtual void addAdminFacet(const CommunicatorPtr&) = 0; - + virtual ObjectPtr getFacet() const = 0; // // Destroy this logger, in particular join any thread diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp index 33b275bd616..a2ffa037994 100644 --- a/cpp/src/Ice/ObjectAdapterI.cpp +++ b/cpp/src/Ice/ObjectAdapterI.cpp @@ -48,7 +48,7 @@ namespace { inline void checkIdentity(const Identity& ident) { - if(ident.name.size() == 0) + if(ident.name.empty()) { throw IllegalIdentityException(__FILE__, __LINE__, ident); } @@ -56,7 +56,7 @@ inline void checkIdentity(const Identity& ident) inline void checkServant(const ObjectPtr& servant) { - if(servant == 0) + if(!servant) { throw IllegalServantException(__FILE__, __LINE__, "cannot add null servant to Object Adapter"); } @@ -640,6 +640,22 @@ Ice::ObjectAdapterI::setLocator(const LocatorPrx& locator) _locatorInfo = _instance->locatorManager()->get(locator); } +LocatorPrx +Ice::ObjectAdapterI::getLocator() const +{ + IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this); + + if(!_locatorInfo) + { + return 0; + } + else + { + return _locatorInfo->getLocator(); + } +} + + void Ice::ObjectAdapterI::refreshPublishedEndpoints() { diff --git a/cpp/src/Ice/ObjectAdapterI.h b/cpp/src/Ice/ObjectAdapterI.h index 52a3865c714..9d2df9ceff9 100644 --- a/cpp/src/Ice/ObjectAdapterI.h +++ b/cpp/src/Ice/ObjectAdapterI.h @@ -80,6 +80,7 @@ public: virtual ObjectPrx createIndirectProxy(const Identity&) const; virtual void setLocator(const LocatorPrx&); + virtual Ice::LocatorPrx getLocator() const; virtual void refreshPublishedEndpoints(); virtual EndpointSeq getEndpoints() const; diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp index 9f175ad76ca..47e52f48a2f 100644 --- a/cpp/src/Ice/PropertyNames.cpp +++ b/cpp/src/Ice/PropertyNames.cpp @@ -6,7 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -// Generated by makeprops.py from file ../config/PropertyNames.xml, Fri Sep 5 15:02:22 2014 +// Generated by makeprops.py from file ../config/PropertyNames.xml, Mon Sep 8 11:41:52 2014 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -65,6 +65,7 @@ const IceInternal::Property IcePropsData[] = IceInternal::Property("Ice.Admin.ThreadPool.ThreadIdleTime", false, 0), IceInternal::Property("Ice.Admin.ThreadPool.ThreadPriority", false, 0), IceInternal::Property("Ice.Admin.DelayCreation", false, 0), + IceInternal::Property("Ice.Admin.Enabled", false, 0), IceInternal::Property("Ice.Admin.Facets", false, 0), IceInternal::Property("Ice.Admin.InstanceName", false, 0), IceInternal::Property("Ice.Admin.Logger", false, 0), diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h index 59faf1f2ddc..fda34651d5c 100644 --- a/cpp/src/Ice/PropertyNames.h +++ b/cpp/src/Ice/PropertyNames.h @@ -6,7 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -// Generated by makeprops.py from file ../config/PropertyNames.xml, Fri Sep 5 15:02:22 2014 +// Generated by makeprops.py from file ../config/PropertyNames.xml, Mon Sep 8 11:41:52 2014 // IMPORTANT: Do not edit this file -- any edits made here will be lost! diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp index 433985d971a..bffc34ae55a 100644 --- a/cpp/src/IceBox/ServiceManagerI.cpp +++ b/cpp/src/IceBox/ServiceManagerI.cpp @@ -618,12 +618,18 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, // // If the Logger is enabled on the IceBox communicator, we tell the service // to create a LoggerAdmin's Logger, by setting the property Ice.Admin.Logger - // + // to a non-default value + + string loggerFacetName; + if(_communicator->findAdminFacet("Logger") != 0) { - if(initData.properties->getPropertyWithDefault("Ice.Admin.Logger", "Logger") == "Logger") + loggerFacetName = initData.properties->getPropertyWithDefault("Ice.Admin.Logger", "Logger"); + + if(loggerFacetName == "Logger") { - initData.properties->setProperty("Ice.Admin.Logger", string("IceBox.Service.") + service + ".Logger"); + loggerFacetName = "IceBox.Service." + service + ".Logger"; + initData.properties->setProperty("Ice.Admin.Logger", loggerFacetName); } } @@ -634,17 +640,17 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, info.communicator = initialize(info.args, initData); communicator = info.communicator; - if(_communicator->findAdminFacet("Logger") != 0) + if(_communicator->findAdminFacet("Logger")) { Ice::LoggerAdminLoggerPtr logger = Ice::LoggerAdminLoggerPtr::dynamicCast(communicator->getLogger()); - assert(logger != 0); // a plugin reset Ice.Admin.Logger to its default?? - if(logger != 0) + assert(logger); // a plugin reset Ice.Admin.Logger to its default?? + if(logger) { // // We add this admin facet to the IceBox main communicator, even though the associated logger // "works" for the service's communicator // - logger->addAdminFacet(_communicator); + _communicator->addAdminFacet(logger->getFacet(), loggerFacetName); } } |