void ReconnectionCallback_i::fini (void) { if (this->id_is_valid_) { NotifyExt::ReconnectionRegistry_var registry = NotifyExt::ReconnectionRegistry::_narrow (this->ecf_.in ()); registry->unregister_callback (this->callback_id_); this->id_is_valid_ = false; } }
void ReconnectionCallback::disconnect() { if (id_is_valid_){ try { NotifyExt::ReconnectionRegistry_var registry = NotifyExt::ReconnectionRegistry::_narrow(ecf_); registry->unregister_callback(callback_id_); } catch(CORBA::SystemException &ex) {} if (!::CORBA::is_nil(root_poa_)) root_poa_->deactivate_object(callback_obj_id_); else services_->deactivateOffShoot(this); id_is_valid_ = false; } }
void ReconnectionCallback_i::init ( PortableServer::POA_ptr poa, CosNotifyChannelAdmin::EventChannelFactory_ptr ecf) { this->ecf_ = CosNotifyChannelAdmin::EventChannelFactory::_duplicate (ecf); PortableServer::ObjectId_var reconnection_callback_id = poa->activate_object (this); CORBA::Object_var obj = poa->id_to_reference (reconnection_callback_id.in ()); NotifyExt::ReconnectionCallback_var callback = NotifyExt::ReconnectionCallback::_narrow (obj.in ()); NotifyExt::ReconnectionRegistry_var registry = NotifyExt::ReconnectionRegistry::_narrow (ecf); this->callback_id_ = registry->register_callback (callback.in ()); this->id_is_valid_ = true; }
void ReconnectionCallback::init( CORBA::ORB_ptr orb_mp, NotifyMonitoringExt::EventChannelFactory_ptr ecf) { if (::CORBA::is_nil(ecf)){ std::cout << "-- ECF is nil :( --" << std::endl; return; } ecf_ = NotifyMonitoringExt::EventChannelFactory::_duplicate(ecf); NotifyExt::ReconnectionCallback_var callback; if (!::CORBA::is_nil(orb_mp)){ ::CORBA::Object_ptr poa = orb_mp->resolve_initial_references("RootPOA"); root_poa_ = PortableServer::POA::_narrow (poa); callback_obj_id_ = root_poa_->activate_object(this); CORBA::Object_var obj = root_poa_->id_to_reference(callback_obj_id_.in()); callback = NotifyExt::ReconnectionCallback::_narrow(obj); } else if (services_ != NULL){ ACS::OffShoot_var shoot = services_->activateOffShoot(this); callback = NotifyExt::ReconnectionCallback::_narrow(shoot.in()); } else return; if (::CORBA::is_nil(callback)) std::cout << "Callback not initializated" << std::endl; NotifyExt::ReconnectionRegistry_var registry = NotifyExt::ReconnectionRegistry::_narrow(ecf_); callback_id_ = registry->register_callback(callback); id_is_valid_ = true; }