//----------------------------------------------------------------------------- void BaseHelper::createNotificationChannel() { //sanity check. If we cannot access the naming service, there is //no point whatsoever in continuing. if(CORBA::is_nil(namingContext_m)){ ACSErrTypeCORBA::CORBAReferenceNilExImpl ex(__FILE__, __LINE__, "BaseHelper::createNotificationChannel"); ex.setVariable("namingContext_m"); throw ex; } //get access to the notification service getNotifyService(); //here is where the channel is actually created notifyChannel_m = notifyFactory_m->create_channel(getQoSProps(), getAdminProps(), channelID_m); //ensure it's a valid reference if(CORBA::is_nil(notifyChannel_m.in())){ ACSErrTypeCORBA::CORBAReferenceNilExImpl ex(__FILE__, __LINE__, "BaseHelper::createNotificationChannel"); ex.setVariable("notifyChannel_m"); throw ex; } // Bind notification channel to Naming service attachChannelToNS(); }
void Helper::reconnect(::NotifyMonitoringExt::EventChannelFactory *ecf) { if (::CORBA::is_nil(notifyChannel_m)) resolveNotifyChannel(); notifyChannel_m->set_qos(getQoSProps()); }
//----------------------------------------------------------------------------- void Helper::createNotificationChannel() { ACS_TRACE("Helper::createNotificationChannel"); ACE_Time_Value start_time = ACE_OS::gettimeofday(); ACE_Time_Value end_time; unsigned long msec = 0; try { //double-check the notification service reference if (CORBA::is_nil(notifyFactory_m.in()) == true) { //it means that the extended notify factory failed to be created. //we will try with the standard implementation if (CORBA::is_nil(notifyFactoryOld_m.in()) == true) { ACS_SHORT_LOG( (LM_ERROR, "Helper::createNotificationChannel() error occured for the '%s' channel, Default Notify factory is nil!", channelName_mp)); CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__, __LINE__, "nc::Helper::createNotificationChannel"); throw err.getCORBAProblemEx(); } //here is where the channel is actually created notifyChannel_m = notifyFactoryOld_m->create_channel(getQoSProps(), getAdminProps(), channelID_m); end_time = ACE_OS::gettimeofday(); } else { //here is where the channel is actually created notifyChannel_m = notifyFactory_m->create_named_channel( getQoSProps(), getAdminProps(), channelID_m, channelName_mp); end_time = ACE_OS::gettimeofday(); } msec = (end_time.sec() - start_time.sec()) * 1000 + (end_time.usec() - start_time.usec()) / 1000; AcsNCTraceLog::LOG_NC_ChannelCreatedRaw_OK TS_RawOK_Log(__FILE__, __LINE__, __PRETTY_FUNCTION__); TS_RawOK_Log.setTimeMillis(msec); TS_RawOK_Log.setChannelName(channelName_mp); TS_RawOK_Log.setChannelId(channelID_m); TS_RawOK_Log.log(); //ensure it's a valid reference if (CORBA::is_nil(notifyChannel_m.in()) == true) { ACS_SHORT_LOG( (LM_ERROR, "Helper::createNotificationChannel() error occured for the '%s' channel, Notify Channel is nil!", channelName_mp)); CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__, __LINE__, "nc::Helper::createNotificationChannel"); throw err.getCORBAProblemEx(); } // Bind notification channel to Naming service CosNaming::Name name(1); name.length(1); name[0].id = CORBA::string_dup(channelAndDomainName_m.c_str()); name[0].kind = acscommon::NC_KIND; //sanity check to make sure the naming service is really there if (CORBA::is_nil(namingContext_m.in()) == true) { ACS_SHORT_LOG( (LM_ERROR, "Helper::createNotificationChannel() error occured for the '%s' channel, Naming Context is nil!", channelName_mp)); CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__, __LINE__, "nc::Helper::createNotificationChannel"); throw err.getCORBAProblemEx(); } //really bind the reference here namingContext_m->rebind(name, notifyChannel_m.in()); } catch (NotifyMonitoringExt::NameAlreadyUsed e) { ACS_SHORT_LOG( (LM_TRACE, "Helper::createNotificationChannel() failed for the '%s' channel, the name is already used!", channelName_mp)); throw e; } catch (NotifyMonitoringExt::NameMapError e) { ACS_SHORT_LOG( (LM_TRACE, "Helper::createNotificationChannel() failed for the '%s' channel, Name Map Error!", channelName_mp)); throw e; } catch (CORBAProblemEx) { //exception thrown by us...OK to rethrow ACS_SHORT_LOG( (LM_TRACE, "Helper::createNotificationChannel() failed for the '%s' channel with a nil pointer!", channelName_mp)); throw; } catch (...) { //lots of things could have caused this (bad QoS props, admin props, etc.) ACS_SHORT_LOG( (LM_ERROR, "Helper::createNotificationChannel() error occured for the '%s' channel, unknown error on createNotificationChannel!", channelName_mp)); CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__, __LINE__, "nc::Helper::createNotificationChannel"); throw err.getCORBAProblemEx(); } }