Guest User

Untitled

a guest
Jul 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. void
  2. LoggingService::create_EC ()
  3. {
  4. CosNaming::Name name (1);
  5. name.length (1);
  6. std::string channelAndDomainName;
  7. // cannot use BaseHelper::combineChannelAndDomainName because of module order
  8. if(!m_logBin)
  9. channelAndDomainName = std::string(acscommon::LOGGING_CHANNEL_XML_NAME);
  10. else
  11. channelAndDomainName = std::string(acscommon::LOGGING_CHANNEL_NAME);
  12. channelAndDomainName = channelAndDomainName + acscommon::NAMESERVICE_BINDING_NC_DOMAIN_SEPARATOR + acscommon::ACS_NC_DOMAIN_LOGGING;
  13. name[0].id = CORBA::string_dup (channelAndDomainName.c_str());
  14. name[0].kind = CORBA::string_dup (acscommon::NC_KIND);
  15.  
  16. int retries = 10;
  17.  
  18. while(retries--) {
  19.  
  20. try
  21. {
  22. //use the naming service to get our object
  23. CORBA::Object_var ec_obj = this->m_naming_context->resolve(name);
  24. ACE_ASSERT(!CORBA::is_nil(ec_obj.in()));
  25.  
  26. //narrow it
  27. m_logging_ec = CosNotifyChannelAdmin::EventChannel::_narrow(ec_obj.in());
  28. ACE_ASSERT(!CORBA::is_nil(m_logging_ec.in()));
  29.  
  30. retries = false;
  31. ACS_SHORT_LOG((LM_INFO, "Logging channel narrowed..."));
  32. }
  33. catch(CosNaming::NamingContext::NotFound ex)
  34. {
  35. ACS_SHORT_LOG((LM_INFO,
  36. "CosNaming::NamingContext::NotFound, retries left %d out of 10",
  37. retries));
  38.  
  39. sleep(1);
  40.  
  41. this->resolve_naming_service();
  42. this->resolve_notify_factory();
  43.  
  44. // // Logging Channel
  45. // CosNotifyChannelAdmin::ChannelID id;
  46. //
  47. // m_logging_ec = m_notify_factory->create_channel (m_initial_qos,
  48. // m_initial_admin,
  49. // id);
  50. //
  51. // ACS_SHORT_LOG ((LM_INFO, "Logging EC registered with the naming service as id = %d, after exception", id));
  52. //
  53. // ACE_ASSERT (!CORBA::is_nil (m_logging_ec.in ()));
  54. // ACE_ASSERT(!CORBA::is_nil (this->m_naming_context.in ()));
  55. //
  56. //
  57. // this->m_naming_context->rebind (name,
  58. // m_logging_ec.in());
  59. //
  60. //
  61. // ACS_SHORT_LOG ((LM_INFO, "Logging EC registered with the naming service as: %s after exception", channelAndDomainName.c_str()));
  62. //
  63. // //ACE_ASSERT(!CORBA::is_nil (this->m_naming_context.in ()));
  64. //
  65. // //CosNaming::Name name (1);
  66. // //name.length (1);
  67. }
  68. }
  69.  
  70. ACS_SHORT_LOG ((LM_INFO, "Logging EC registered with the naming service as: %s", channelAndDomainName.c_str()));
  71. }
Add Comment
Please, Sign In to add comment