void TAO_CosNotify_Service::init_i2 (CORBA::ORB_ptr orb, CORBA::ORB_ptr dispatching_orb) { // Obtain the Root POA CORBA::Object_var object = orb->resolve_initial_references("RootPOA"); if (CORBA::is_nil (object.in ())) ORBSVCS_ERROR ((LM_ERROR, " (%P|%t) Unable to resolve the RootPOA.\n")); PortableServer::POA_var default_poa = PortableServer::POA::_narrow (object.in ()); // Set the properties TAO_Notify_Properties* properties = TAO_Notify_PROPERTIES::instance(); properties->orb (orb); properties->dispatching_orb (dispatching_orb); properties->separate_dispatching_orb (true); properties->default_poa (default_poa.in ()); // Init the factory and builder this->factory_.reset (this->create_factory ()); ACE_ASSERT( this->factory_.get() != 0 ); TAO_Notify_PROPERTIES::instance()->factory (this->factory_.get()); this->builder_.reset (this->create_builder ()); ACE_ASSERT( this->builder_.get() != 0 ); TAO_Notify_PROPERTIES::instance()->builder (this->builder_.get()); }
void TAO_Notify_EventChannelFactory::destroy (void) { if (this->shutdown () == 1) return; TAO_Notify_Properties* properties = TAO_Notify_PROPERTIES::instance(); // Reset references to CORBA objects. properties->orb (CORBA::ORB::_nil ()); properties->default_poa (PortableServer::POA::_nil ()); ec_container_.reset( 0 ); }
void TAO_Notify_FilterAdmin::save_persistent (TAO_Notify::Topology_Saver& saver) { if (this->filter_list_.current_size() == 0) return; bool changed = true; TAO_Notify::NVPList attrs; bool want_children = saver.begin_object(0, "filter_admin", attrs, changed); if (want_children) { FILTER_LIST::ITERATOR iter (this->filter_list_); FILTER_LIST::ENTRY* entry; TAO_Notify_Properties* properties = TAO_Notify_PROPERTIES::instance(); CORBA::ORB_var orb = properties->orb(); ACE_ASSERT(! CORBA::is_nil(orb.in())); for (; iter.next(entry) != 0; iter.advance()) { TAO_Notify::NVPList fattrs; CORBA::Long id = entry->ext_id_; //TBD: this presume the filter always collocated. //otherwise we need modify the filter interface to add get_filter_id() TAO_Notify_FilterFactory* factory = ec_->default_filter_factory_servant (); TAO_Notify_Object::ID mapid = factory->get_filter_id (entry->int_id_.in ()); fattrs.push_back(TAO_Notify::NVP("MapId", mapid)); saver.begin_object(id, "filter", fattrs, changed); saver.end_object(id, "filter"); } } saver.end_object(0, "filter_admin"); }
int TAO_CosNotify_Service::init (int argc, ACE_TCHAR *argv[]) { ACE_Arg_Shifter arg_shifter (argc, argv); const ACE_TCHAR *current_arg = 0; // Default to an all reactive system. int ec_threads = 0; int consumer_threads = 0; int supplier_threads = 0; bool task_per_proxy = false; TAO_Notify_Properties *properties = TAO_Notify_PROPERTIES::instance(); while (arg_shifter.is_anything_left ()) { if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-MTDispatching")) == 0) { arg_shifter.consume_arg (); ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) The -MTDispatching option has been deprecated, use -DispatchingThreads\n"))); } else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-DispatchingThreads")))) { consumer_threads += ACE_OS::atoi (current_arg); arg_shifter.consume_arg (); } else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-MTSourceEval")) == 0) { arg_shifter.consume_arg (); ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) The -MTSourceEval option has been deprecated, use -SourceThreads\n"))); } else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-SourceThreads")))) { supplier_threads += ACE_OS::atoi (current_arg); arg_shifter.consume_arg (); } else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-MTLookup")) == 0) { arg_shifter.consume_arg (); ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) The -MTLookup option has been deprecated, use -SourceThreads\n"))); } else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-LookupThreads")))) { supplier_threads += ACE_OS::atoi (current_arg); arg_shifter.consume_arg (); ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) The -LookupThreads option has been deprecated, use -SourceThreads\n"))); } else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-MTListenerEval")) == 0) { arg_shifter.consume_arg (); ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) The -MTListenerEval option has been deprecated, use -DispatchingThreads\n"))); } else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-ListenerThreads")))) { // Since this option is always added to consumer_threads, we'll // deprecate it in favor of that option. ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) The -ListenerThreads option has been deprecated, use -DispatchingThreads\n"))); consumer_threads += ACE_OS::atoi (current_arg); arg_shifter.consume_arg (); } else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-AsynchUpdates")) == 0) { arg_shifter.consume_arg (); properties->asynch_updates (1); } else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-NoUpdates")) == 0) { arg_shifter.consume_arg (); properties->updates (0); } else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-AllocateTaskperProxy")) == 0) { task_per_proxy = true; arg_shifter.consume_arg (); } else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-UseSeparateDispatchingORB")) == 0) { current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-UseSeparateDispatchingORB")); if (current_arg != 0 && (ACE_OS::strcmp(ACE_TEXT ("0"), current_arg) == 0 || ACE_OS::strcmp(ACE_TEXT ("1"), current_arg) == 0)) { properties->separate_dispatching_orb ( static_cast<bool> (ACE_OS::atoi(current_arg))); ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("Using separate Dispatching ORB\n"))); } else { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) WARNING: Unrecognized ") ACE_TEXT ("argument (%s). Ignoring invalid ") ACE_TEXT ("-UseSeparateDispatchingORB usage.\n"), (current_arg == 0 ? ACE_TEXT ("''") : current_arg))); } if (current_arg != 0) arg_shifter.consume_arg (); } else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-AllowReconnect")) == 0) { arg_shifter.consume_arg (); TAO_Notify_PROPERTIES::instance()->allow_reconnect (true); } else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-DefaultConsumerAdminFilterOp")) == 0) { current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-DefaultConsumerAdminFilterOp")); CosNotifyChannelAdmin::InterFilterGroupOperator op = CosNotifyChannelAdmin::OR_OP; if (current_arg != 0 && (ACE_OS::strcmp(ACE_TEXT ("AND"), current_arg) == 0)) op = CosNotifyChannelAdmin::AND_OP; else if (current_arg != 0 && (ACE_OS::strcmp(ACE_TEXT ("OR"), current_arg) == 0)) op = CosNotifyChannelAdmin::OR_OP; else { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) WARNING: Unrecognized ") ACE_TEXT ("argument (%s). Ignoring invalid ") ACE_TEXT ("-DefaultConsumerAdminFilterOp usage.\n"), (current_arg == 0 ? ACE_TEXT ("''") : current_arg))); } properties->defaultConsumerAdminFilterOp (op); arg_shifter.consume_arg (); } else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-DefaultSupplierAdminFilterOp")) == 0) { current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-DefaultSupplierAdminFilterOp")); CosNotifyChannelAdmin::InterFilterGroupOperator op = CosNotifyChannelAdmin::OR_OP; if (current_arg != 0 && (ACE_OS::strcmp(ACE_TEXT ("AND"), current_arg) == 0)) op = CosNotifyChannelAdmin::AND_OP; else if (current_arg != 0 && (ACE_OS::strcmp(ACE_TEXT ("OR"), current_arg) == 0)) op = CosNotifyChannelAdmin::OR_OP; else { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) WARNING: Unrecognized ") ACE_TEXT ("argument (%s). Ignoring invalid ") ACE_TEXT ("-DefaultSupplierAdminFilterOp usage.\n"), (current_arg == 0 ? ACE_TEXT ("''") : current_arg))); } properties->defaultSupplierAdminFilterOp (op); arg_shifter.consume_arg (); } else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-ValidateClient")) == 0) { arg_shifter.consume_arg (); TAO_Notify_PROPERTIES::instance()->validate_client (true); ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("Using reactive client control.\n"))); } else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-ValidateClientDelay")) == 0) { current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-ValidateClientDelay")); if (current_arg != 0) { ACE_Time_Value tv (ACE_OS::atoi (current_arg)); TAO_Notify_PROPERTIES::instance()->validate_client_delay (tv); } else { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) WARNING: Unrecognized ") ACE_TEXT ("argument (%s). Ignoring invalid ") ACE_TEXT ("-ValidateClientDelay usage.\n"), (current_arg == 0 ? ACE_TEXT ("''") : current_arg))); } if (current_arg != 0) arg_shifter.consume_arg (); } else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-ValidateClientInterval")) == 0) { current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-ValidateClientInterval")); if (current_arg != 0) { ACE_Time_Value tv (ACE_OS::atoi (current_arg)); TAO_Notify_PROPERTIES::instance()->validate_client_interval (tv); } else { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) WARNING: Unrecognized ") ACE_TEXT ("argument (%s). Ignoring invalid ") ACE_TEXT ("-ValidateClientDelay usage.\n"), (current_arg == 0 ? ACE_TEXT ("''") : current_arg))); } if (current_arg != 0) arg_shifter.consume_arg (); } else { ORBSVCS_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Ignoring unknown option for Notify Factory: %s\n"), arg_shifter.get_current() )); arg_shifter.consume_arg (); } } // Init the EC QoS { CosNotification::QoSProperties qos; this->set_threads (qos, ec_threads); properties->default_event_channel_qos_properties (qos); } if (!task_per_proxy) { // Set the per ConsumerAdmin QoS { if (consumer_threads > 0) ORBSVCS_DEBUG((LM_DEBUG, "Using %d threads for each ConsumerAdmin.\n", consumer_threads)); CosNotification::QoSProperties qos; this->set_threads (qos, consumer_threads); properties->default_consumer_admin_qos_properties (qos); } // Set the per SupplierAdmin QoS { if (supplier_threads > 0) ORBSVCS_DEBUG((LM_DEBUG, "Using %d threads for each SupplierAdmin.\n", supplier_threads)); CosNotification::QoSProperties qos; this->set_threads (qos, supplier_threads); properties->default_supplier_admin_qos_properties (qos); } } else { // Set the per ProxyConsumer QoS { if (supplier_threads > 0) ORBSVCS_DEBUG((LM_DEBUG, "Using %d threads for each Supplier.\n", supplier_threads)); CosNotification::QoSProperties qos; this->set_threads (qos, supplier_threads); // lookup thread per proxy doesn't make sense. properties->default_proxy_consumer_qos_properties (qos); } // Set the per ProxySupplier QoS { if (consumer_threads > 0) ORBSVCS_DEBUG((LM_DEBUG, "Using %d threads for each Consumer.\n", consumer_threads)); CosNotification::QoSProperties qos; this->set_threads (qos, consumer_threads); properties->default_proxy_supplier_qos_properties (qos); } } return 0; }