Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void
- LoggingService::create_EC ()
- {
- CosNaming::Name name (1);
- name.length (1);
- std::string channelAndDomainName;
- // cannot use BaseHelper::combineChannelAndDomainName because of module order
- if(!m_logBin)
- channelAndDomainName = std::string(acscommon::LOGGING_CHANNEL_XML_NAME);
- else
- channelAndDomainName = std::string(acscommon::LOGGING_CHANNEL_NAME);
- channelAndDomainName = channelAndDomainName + acscommon::NAMESERVICE_BINDING_NC_DOMAIN_SEPARATOR + acscommon::ACS_NC_DOMAIN_LOGGING;
- name[0].id = CORBA::string_dup (channelAndDomainName.c_str());
- name[0].kind = CORBA::string_dup (acscommon::NC_KIND);
- int retries = 10;
- while(retries--) {
- try
- {
- //use the naming service to get our object
- CORBA::Object_var ec_obj = this->m_naming_context->resolve(name);
- ACE_ASSERT(!CORBA::is_nil(ec_obj.in()));
- //narrow it
- m_logging_ec = CosNotifyChannelAdmin::EventChannel::_narrow(ec_obj.in());
- ACE_ASSERT(!CORBA::is_nil(m_logging_ec.in()));
- retries = false;
- ACS_SHORT_LOG((LM_INFO, "Logging channel narrowed..."));
- }
- catch(CosNaming::NamingContext::NotFound ex)
- {
- ACS_SHORT_LOG((LM_INFO,
- "CosNaming::NamingContext::NotFound, retries left %d out of 10",
- retries));
- sleep(1);
- this->resolve_naming_service();
- this->resolve_notify_factory();
- // // Logging Channel
- // CosNotifyChannelAdmin::ChannelID id;
- //
- // m_logging_ec = m_notify_factory->create_channel (m_initial_qos,
- // m_initial_admin,
- // id);
- //
- // ACS_SHORT_LOG ((LM_INFO, "Logging EC registered with the naming service as id = %d, after exception", id));
- //
- // ACE_ASSERT (!CORBA::is_nil (m_logging_ec.in ()));
- // ACE_ASSERT(!CORBA::is_nil (this->m_naming_context.in ()));
- //
- //
- // this->m_naming_context->rebind (name,
- // m_logging_ec.in());
- //
- //
- // ACS_SHORT_LOG ((LM_INFO, "Logging EC registered with the naming service as: %s after exception", channelAndDomainName.c_str()));
- //
- // //ACE_ASSERT(!CORBA::is_nil (this->m_naming_context.in ()));
- //
- // //CosNaming::Name name (1);
- // //name.length (1);
- }
- }
- ACS_SHORT_LOG ((LM_INFO, "Logging EC registered with the naming service as: %s", channelAndDomainName.c_str()));
- }
Add Comment
Please, Sign In to add comment