diff options
author | pradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-02-26 07:48:31 +0000 |
---|---|---|
committer | pradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-02-26 07:48:31 +0000 |
commit | 4f38ae570ea7355fb227ba3698b96082fd23aa76 (patch) | |
tree | fc70c8de3615f50f096ad7007037be237f95887a /TAO | |
parent | 1586f6fd7343bf3b818e8c4b1eb83112a0c08ade (diff) | |
download | ATCD-4f38ae570ea7355fb227ba3698b96082fd23aa76.tar.gz |
Mon Feb 26 01:47:04 2001 Pradeep Gore <pradeep@cs.wustl.edu>
Diffstat (limited to 'TAO')
29 files changed, 437 insertions, 168 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 7cd37308497..f690a834192 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,11 +1,54 @@ +Mon Feb 26 01:47:04 2001 Pradeep Gore <pradeep@cs.wustl.edu> + + * orbsvcs/Notify_Service/Notify_Service.cpp: + * orbsvcs/Notify_Service/svc.conf: + Corrected the "-Notify_TPReactor" option. + + * orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.cpp: + * orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.h: + * orbsvcs/Notify_Service/README: + - Added the "-AllocateTaskperProxy" option to pre-allocate the + worker task(s) used in event processing. + - Added "-AsynchUpdates" option to send subscription/publication + updates asynchromously. + - Event Manager Object Factory is allocated per channel now. + + * orbsvcs/orbsvcs/Notify/Notify_Buffering_Strategy.cpp: + * orbsvcs/orbsvcs/Notify/Notify_ConsumerAdmin_i.cpp: + * orbsvcs/orbsvcs/Notify/Notify_Default_Collection_Factory.cpp: + * orbsvcs/orbsvcs/Notify/Notify_Default_POA_Factory.cpp: + * orbsvcs/orbsvcs/Notify/Notify_EventChannel_i.cpp: + * orbsvcs/orbsvcs/Notify/Notify_Event_Manager.cpp: + * orbsvcs/orbsvcs/Notify/Notify_Event_Manager.h: + * orbsvcs/orbsvcs/Notify/Notify_Event_Manager.i: + * orbsvcs/orbsvcs/Notify/Notify_Event_Manager_Objects_Factory.h: + * orbsvcs/orbsvcs/Notify/Notify_Event_Map.cpp: + * orbsvcs/orbsvcs/Notify/Notify_Event_Map.h: + * orbsvcs/orbsvcs/Notify/Notify_Event_Processor.cpp: + * orbsvcs/orbsvcs/Notify/Notify_Factory.cpp: + * orbsvcs/orbsvcs/Notify/Notify_Factory.h: + * orbsvcs/orbsvcs/Notify/Notify_Filter_i.cpp: + * orbsvcs/orbsvcs/Notify/Notify_MT_Worker_Task.cpp: + * orbsvcs/orbsvcs/Notify/Notify_ProxyConsumer_T.cpp: + * orbsvcs/orbsvcs/Notify/Notify_ProxySupplier_T.cpp: + * orbsvcs/orbsvcs/Notify/Notify_Proxy_T.cpp: + * orbsvcs/orbsvcs/Notify/Notify_SupplierAdmin_i.cpp: + Trivial debug messages will print conditionally. use ORBDebugLevel + option to see debug messages. + + * orbsvcs/tests/Notify/performance-tests/RedGreen/README: + * orbsvcs/tests/Notify/performance-tests/RedGreen/listener.conf: + * orbsvcs/tests/Notify/performance-tests/RedGreen/lookup.conf: + Updates files to correct configurations. + Mon Feb 26 01:24:00 2001 Michael Kircher <Michael.Kircher@mchp.siemens.de> * TAO/ValueBase.cpp: - The code of value types needs a urgent repair in many places. + The code of value types needs a urgent repair in many places. With this change I fixed how the ORB was obtained - from fetching it via TAO_ORB_Core_instance to fetching it via the CDR stream, which owns a correct reference to it. - With TAO_ORB_Core_instance we could have actually fetched + With TAO_ORB_Core_instance we could have actually fetched the wrong ORB. Sun Feb 25 19:37:24 2001 Carlos O'Ryan <coryan@uci.edu> diff --git a/TAO/orbsvcs/Notify_Service/Notify_Service.cpp b/TAO/orbsvcs/Notify_Service/Notify_Service.cpp index 009ac1f08ae..45d7b741fa0 100644 --- a/TAO/orbsvcs/Notify_Service/Notify_Service.cpp +++ b/TAO/orbsvcs/Notify_Service/Notify_Service.cpp @@ -60,16 +60,6 @@ Notify_Service::init_ORB (int& argc, char *argv [], poa_manager->activate (ACE_TRY_ENV); ACE_CHECK_RETURN (-1); - if (this->nthreads_ > 0) // we have chosen to run in a thread pool. - { - ACE_DEBUG ((LM_DEBUG, "Running %d server threads\n", this->nthreads_)); - worker_.orb (this->orb_.in ()); - - if (worker_.activate (THR_NEW_LWP | THR_JOINABLE, - this->nthreads_) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Cannot activate client threads\n"), -1); - } return 0; } @@ -87,6 +77,16 @@ Notify_Service::startup (int argc, char *argv[], if (this->parse_args(argc, argv) != 0) return -1; + if (this->nthreads_ > 0) // we have chosen to run in a thread pool. + { + ACE_DEBUG ((LM_DEBUG, "Running %d server threads\n", this->nthreads_)); + worker_.orb (this->orb_.in ()); + + if (worker_.activate (THR_NEW_LWP | THR_JOINABLE, + this->nthreads_) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Cannot activate client threads\n"), -1); + } // Check first if the naming service if (this->use_name_svc_) { @@ -362,6 +362,8 @@ Notify_Service::parse_args(int argc, char *argv[]) } else { + /*ACE_DEBUG((LM_DEBUG, "Unrecognized command %s", + arg_shifter.get_current ()));*/ arg_shifter.ignore_arg (); } } diff --git a/TAO/orbsvcs/Notify_Service/README b/TAO/orbsvcs/Notify_Service/README index 3a32ca42431..d329b54cf54 100644 --- a/TAO/orbsvcs/Notify_Service/README +++ b/TAO/orbsvcs/Notify_Service/README @@ -42,7 +42,7 @@ Command line arguments: "-Notify_TPReactor [threads]": Tells the Notify Service that the ORB will use a TP reactor and specifies the number of worker threads to utilize. - + Note that the svc.conf file must instruct the oRB to use a TP reactor e.g. static Resource_Factory "-ORBReactorType tp -ORBReactorMaskSignals 0" @@ -80,26 +80,70 @@ The svc.conf options: The "Notify_Default_Event_Manager_Objects_Factory" service object accepts the following options: -"-MTDispatching" : Enable MT dispatching +"-MTDispatching" : Enable MT dispatching "-DispatchingThreads [thread_count]" : How many threads for MT dispatching. -"-MTSourceEval" : Enable MT proxy consumer(source) filter evaluation. +"-MTSourceEval" : Enable MT proxy consumer(source) filter evaluation. "-SourceThreads [thread_count]" : How many threads for source filter evaluation. "-MTLookup" : Enable MT subscription table lookup. "-LookupThreads [thread_count]" : How many lookup threads. -"-MTListenerEval" : Enable MT proxy supplier (listener) filter evaluation. +"-MTListenerEval" : Enable MT proxy supplier (listener) filter evaluation. "-ListenerThreads" : How many threads for listener filter evaluation. "-Notify_TPReactor [threads]" : Tells the service that the ORB is using a TP reactor and specifies the number of worker - threads to deploy. + threads to deploy. Note that you might have to - specify the TP reactor in the + specify the TP reactor in the svc.conf file. (see the ORB configutrations for details on this) + +"-AsynchUpdates" : Send subscription and + publication updates asynchronously. + +"-AllocateTaskperProxy" : Allocate worker tasks per + proxy for the following + options: + "-MTDispatching", + "-MTSourceEval" + "-MTListenerEval" + *see footnote below for explaination* + e.g. svc.conf static Notify_Default_Event_Manager_Objects_Factory "-MTSourceEval -MTDispatching -DispatchingThreads 2" This means that we want to enable MT proxy supplier filter evaluation (default 1 thread) and MT event dispatching with 2 threads. +---------------------------------------------------------------- +What does the "-AllocateTaskperProxy" option do? + +A Task here implies a thread pool that performs a fixed work in the +Notify. +e.g. When you specify "-MTDispatching" and set "DispatchingThreads 1". +It means that there is 1 thread to perform the event dispatching to +consumers IRRESPECTIVE OF THE NUMBER OF PROXYSUPPLIERS. +This is the default case. + +When you specify "-AllocateTaskperProxy" it asks notify to create a +dispatching task (with the specified thread pool size) PER +PROXYSUPPLIER. So if you use this option and connect 50 consumers with +1 thread for the dispaching task you will have created 50 dispatching +threads! so use this option with care and you might not need it in +most cases. + +why have this feature in the first place? The intent is to allow the +software architect of a Notify based system, fine control over where +and how much thread resources are deployed. e.g. a channel could have +2 proxy suppliers - the first one delivers an important event in huge +quantities. A dedicated thread pool to this proxy will ensure better +throughput to it's consumers. (Eventually i want to be able to set the +thread pool size via a QoS property) + +Similarly, the "-MTSourceEval" specifies a thread pool for the filter +evauation at the proxyconsumer ("Source"). +and the "-MTListenerEval" specifies a thread pool for the filter +evauation at the proxyconsumer ("Listener"). + +thanks, +Pradeep <pradeep@cs.wustl.edu> diff --git a/TAO/orbsvcs/Notify_Service/svc.conf b/TAO/orbsvcs/Notify_Service/svc.conf index fe67b17f840..4e5403f39ac 100644 --- a/TAO/orbsvcs/Notify_Service/svc.conf +++ b/TAO/orbsvcs/Notify_Service/svc.conf @@ -1,2 +1 @@ -static Notify_Default_Event_Manager_Objects_Factory "-MTDispatching" - +static Notify_Default_Event_Manager_Objects_Factory "-MTDispatching -DispatchingThreads 1" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Buffering_Strategy.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Buffering_Strategy.cpp index 4c7da8c40a1..0870b9ec9d4 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Buffering_Strategy.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Buffering_Strategy.cpp @@ -61,7 +61,8 @@ TAO_Notify_Buffering_Strategy::execute (ACE_Message_Queue<ACE_SYNCH>* msg_queue, } else if (this->order_policy_ == CosNotification::PriorityOrder) { - ACE_DEBUG ((LM_DEBUG, "enqueue in priority order\n")); + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "enqueue in priority order\n")); result = msg_queue->enqueue_prio (mb, tv); } else // CosNotification::DeadlineOrder @@ -72,7 +73,10 @@ TAO_Notify_Buffering_Strategy::execute (ACE_Message_Queue<ACE_SYNCH>* msg_queue, } if (result == -1) // we could not enqueue successfully - return; // behave as if we discarded this event. + { + ACE_DEBUG ((LM_DEBUG, "Panic! failed to enqueue event")); + return; // behave as if we discarded this event. + } // increment the global count of events. (*queue_length_)++; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_ConsumerAdmin_i.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_ConsumerAdmin_i.cpp index 5fb3ab0dd23..5de28a7c64f 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_ConsumerAdmin_i.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_ConsumerAdmin_i.cpp @@ -35,7 +35,6 @@ TAO_Notify_ConsumerAdmin_i::TAO_Notify_ConsumerAdmin_i (TAO_Notify_EventChannel_ // arguments. channel_objects_factory_ (TAO_Notify_Factory::get_channel_objects_factory ()), poa_factory_ (TAO_Notify_Factory::get_poa_factory ()), - event_manager_objects_factory_ (TAO_Notify_Factory::get_event_manager_objects_factory ()), collection_factory_ (TAO_Notify_Factory::get_collection_factory ()), event_manager_ (event_channel->get_event_manager ()), event_listener_list_ (0), @@ -43,13 +42,15 @@ TAO_Notify_ConsumerAdmin_i::TAO_Notify_ConsumerAdmin_i (TAO_Notify_EventChannel_ filter_eval_task_ (0) { // @@ Pradeep: don't forget the this-> stuff for local variables. + this->event_manager_objects_factory_ = this->event_manager_->resource_factory (); this->event_channel_->_add_ref (); // we don't want our parent to go away! } // Implementation skeleton destructor TAO_Notify_ConsumerAdmin_i::~TAO_Notify_ConsumerAdmin_i (void) { - ACE_DEBUG ((LM_DEBUG,"in CA %d dtor\n", this->my_id_)); + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG,"in CA %d dtor\n", this->my_id_)); ACE_DECLARE_NEW_CORBA_ENV; @@ -178,6 +179,8 @@ TAO_Notify_ConsumerAdmin_i::init (CosNotifyChannelAdmin::AdminID my_id, ACE_CHECK; // Create the task to forward filtering/dispatching commands to: + // @@ think about how get rid of these 2 allocations per consumer admin. + // add a "get_singleton_reactive_task" to the event manager factory interface. this->dispatching_task_ = new TAO_Notify_Worker_Task (); /*this->event_manager_objects_factory_->create_dispatching_task (ACE_TRY_ENV); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_Collection_Factory.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_Collection_Factory.cpp index 7a8c23d97fc..c9c165527f1 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_Collection_Factory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_Collection_Factory.cpp @@ -35,7 +35,6 @@ TAO_Notify_Default_Collection_Factory::init (int /*argc*/, char* /*argv*/[]) int TAO_Notify_Default_Collection_Factory::fini (void) { - ACE_DEBUG ((LM_DEBUG, "TAO_Notify_Default_Collection_Factory::fini\n")); return 0; } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.cpp index 2231bb97ff3..490a1ce7968 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.cpp @@ -13,6 +13,26 @@ ACE_RCSID(Notify, Notify_Default_EMO_Factory, "$Id$") +#define ASYNCH_UPDATES_THREADS 1 + // The number of threads to send subscription/publication updates. + // As this is a relatively adminstrative function. let's just use 1 + // thread to send the updates asynchronously. + + + TAO_EMO_Options::TAO_EMO_Options (void) + : mt_dispatching_ (0), + mt_source_eval_ (0), + mt_lookup_ (0), + mt_listener_eval_ (0), + asynch_updates_ (0), + alloc_task_per_proxy_ (0), + dispatching_threads_ (1), + source_threads_ (1), + lookup_threads_ (1), + listener_threads_ (1) +{ +} + int TAO_Notify_Default_EMO_Factory::init_svc (void) { @@ -21,25 +41,23 @@ TAO_Notify_Default_EMO_Factory::init_svc (void) } TAO_Notify_Default_EMO_Factory::TAO_Notify_Default_EMO_Factory (void) - : mt_dispatching_ (0), - mt_source_eval_ (0), - mt_lookup_ (0), - mt_listener_eval_ (0), - dispatching_threads_ (1), - source_threads_ (1), - lookup_threads_ (1), - listener_threads_ (1) + :prealloc_source_eval_task_ (0), + prealloc_listener_eval_task_ (0), + prealloc_dispatching_task_ (0) { } TAO_Notify_Default_EMO_Factory::~TAO_Notify_Default_EMO_Factory () { + delete prealloc_source_eval_task_; + delete prealloc_listener_eval_task_; + delete prealloc_dispatching_task_; } int TAO_Notify_Default_EMO_Factory::init (int argc, char* argv[]) { - ACE_DEBUG ((LM_DEBUG, "TAO_Notify_Default_EMO_Factory::init\n")); + // ACE_DEBUG ((LM_DEBUG, "TAO_Notify_Default_EMO_Factory::init\n")); ACE_Arg_Shifter arg_shifter (argc, argv); @@ -50,56 +68,126 @@ TAO_Notify_Default_EMO_Factory::init (int argc, char* argv[]) if (ACE_OS::strcasecmp (arg, "-MTDispatching") == 0) { - this->mt_dispatching_ = 1; + EMO_OPTIONS::instance ()->mt_dispatching_ = 1; arg_shifter.consume_arg (); } else if ((current_arg = arg_shifter.get_the_parameter ("-DispatchingThreads"))) { - this->dispatching_threads_ = ACE_OS::atoi (current_arg); + EMO_OPTIONS::instance ()->dispatching_threads_ = ACE_OS::atoi (current_arg); arg_shifter.consume_arg (); } else if (ACE_OS::strcasecmp (arg, "-MTSourceEval") == 0) { - this->mt_source_eval_ = 1; + EMO_OPTIONS::instance ()->mt_source_eval_ = 1; arg_shifter.consume_arg (); } else if ((current_arg = arg_shifter.get_the_parameter ("-SourceThreads"))) { - this->source_threads_ = ACE_OS::atoi (current_arg); + EMO_OPTIONS::instance ()->source_threads_ = ACE_OS::atoi (current_arg); arg_shifter.consume_arg (); } else if (ACE_OS::strcasecmp (arg, "-MTLookup") == 0) { - this->mt_lookup_ = 1; + EMO_OPTIONS::instance ()->mt_lookup_ = 1; arg_shifter.consume_arg (); } else if ((current_arg = arg_shifter.get_the_parameter ("-LookupThreads"))) { - this->lookup_threads_ = ACE_OS::atoi (current_arg); + EMO_OPTIONS::instance ()->lookup_threads_ = ACE_OS::atoi (current_arg); arg_shifter.consume_arg (); } else if (ACE_OS::strcasecmp (arg, "-MTListenerEval") == 0) { - this->mt_listener_eval_ = 1; + EMO_OPTIONS::instance ()->mt_listener_eval_ = 1; arg_shifter.consume_arg (); } else if ((current_arg = arg_shifter.get_the_parameter ("-ListenerThreads"))) { - this->listener_threads_ = ACE_OS::atoi (current_arg); + EMO_OPTIONS::instance ()->listener_threads_ = ACE_OS::atoi (current_arg); + arg_shifter.consume_arg (); + } + else if (ACE_OS::strcasecmp (arg, "-AsynchUpdates") == 0) + { + EMO_OPTIONS::instance ()->asynch_updates_ = 1; + arg_shifter.consume_arg (); + } + else if (ACE_OS::strcasecmp (arg, "-AllocateTaskperProxy") == 0) + { + EMO_OPTIONS::instance ()->alloc_task_per_proxy_ = 1; arg_shifter.consume_arg (); } else { - arg_shifter.ignore_arg (); + ACE_DEBUG ((LM_DEBUG,"EMO Factory did not understand %s",arg)); + arg_shifter.ignore_arg (); } } + + return 0; +} + +TAO_Notify_Worker_Task* +TAO_Notify_Default_EMO_Factory::create_task (int mt, int tp_size,CORBA::Environment &ACE_TRY_ENV) +{ + TAO_Notify_Worker_Task* task; + + int threads_flags = + THR_SCHED_DEFAULT|THR_BOUND|THR_NEW_LWP; + + // int dispatching_threads_priority + + // Later: give the user options to specify threads flags and thread priority for each task. + + if (mt == 1) + ACE_NEW_THROW_EX (task, TAO_Notify_MT_Worker_Task (tp_size, + threads_flags, + 0), + CORBA::NO_MEMORY ()); + else + ACE_NEW_THROW_EX (task, + TAO_Notify_Worker_Task (), + CORBA::NO_MEMORY ()); + return task; +} + + +int +TAO_Notify_Default_EMO_Factory::init_instance (void) +{ + if (EMO_OPTIONS::instance ()->alloc_task_per_proxy_ == 0) // preallocate all tasks. + { + return this->preallocate_tasks (); + } + return 0; +} + +int +TAO_Notify_Default_EMO_Factory::preallocate_tasks (void) +{ + ACE_DECLARE_NEW_CORBA_ENV; + + this->prealloc_source_eval_task_ = + create_task (EMO_OPTIONS::instance ()->mt_source_eval_, EMO_OPTIONS::instance ()->source_threads_, + ACE_TRY_ENV); + ACE_CHECK_RETURN (-1); + + this->prealloc_listener_eval_task_ = + create_task (EMO_OPTIONS::instance ()->mt_listener_eval_, EMO_OPTIONS::instance ()->listener_threads_, + ACE_TRY_ENV); + ACE_CHECK_RETURN (-1); + + this->prealloc_dispatching_task_ = + create_task (EMO_OPTIONS::instance ()->mt_dispatching_, EMO_OPTIONS::instance ()->dispatching_threads_, + ACE_TRY_ENV); + ACE_CHECK_RETURN (-1); + return 0; } int TAO_Notify_Default_EMO_Factory::fini (void) { - ACE_DEBUG ((LM_DEBUG, "TAO_Notify_Default_EMO_Factory::fini\n")); + // ACE_DEBUG ((LM_DEBUG, "TAO_Notify_Default_EMO_Factory::fini\n")); return 0; } @@ -108,7 +196,7 @@ TAO_Notify_Default_EMO_Factory::create_event_manager (TAO_Notify_EventChannel_i* { TAO_Notify_Event_Manager* event_manager; ACE_NEW_THROW_EX (event_manager, - TAO_Notify_Event_Manager (channel), + TAO_Notify_Event_Manager (channel, this), CORBA::NO_MEMORY ()); return event_manager; } @@ -118,7 +206,7 @@ TAO_Notify_Default_EMO_Factory::create_event_map (CORBA::Environment &ACE_TRY_EN { TAO_Notify_Event_Map* event_map; ACE_NEW_THROW_EX (event_map, - TAO_Notify_Event_Map (), + TAO_Notify_Event_Map (this), CORBA::NO_MEMORY ()); return event_map; } @@ -137,96 +225,109 @@ TAO_Notify_Default_EMO_Factory::create_event_processor (TAO_Notify_Event_Manager TAO_Notify_Worker_Task* TAO_Notify_Default_EMO_Factory::create_source_eval_task (CORBA::Environment &ACE_TRY_ENV) { - // @@ pass the correct option to initialize this as passive/active object. - TAO_Notify_Worker_Task* task; - - if (this->mt_source_eval_ == 1) - ACE_NEW_THROW_EX (task, TAO_Notify_MT_Worker_Task (this->source_threads_), - CORBA::NO_MEMORY ()); + if (EMO_OPTIONS::instance ()->alloc_task_per_proxy_ == 1) + return create_task (EMO_OPTIONS::instance ()->mt_source_eval_, + EMO_OPTIONS::instance ()->source_threads_, + ACE_TRY_ENV); else - ACE_NEW_THROW_EX (task, - TAO_Notify_Worker_Task (), - CORBA::NO_MEMORY ()); - return task; + return prealloc_source_eval_task_; } TAO_Notify_Worker_Task* TAO_Notify_Default_EMO_Factory::create_lookup_task (CORBA::Environment &ACE_TRY_ENV) { - // @@ pass the correct option to initialize this as passive/active object. - TAO_Notify_Worker_Task* task; - - if (this->mt_lookup_ == 1) - ACE_NEW_THROW_EX (task, TAO_Notify_MT_Worker_Task (this->lookup_threads_), - CORBA::NO_MEMORY ()); - else - ACE_NEW_THROW_EX (task, - TAO_Notify_Worker_Task (), - CORBA::NO_MEMORY ()); - return task; + return create_task (EMO_OPTIONS::instance ()->mt_lookup_, + EMO_OPTIONS::instance ()->lookup_threads_, ACE_TRY_ENV); } TAO_Notify_Worker_Task* TAO_Notify_Default_EMO_Factory::create_listener_eval_task (CORBA::Environment &ACE_TRY_ENV) { - // @@ pass the correct option to initialize this as passive/active object. - TAO_Notify_Worker_Task* task; - - if (this->mt_listener_eval_ == 1) - ACE_NEW_THROW_EX (task, TAO_Notify_MT_Worker_Task (this->listener_threads_), - CORBA::NO_MEMORY ()); + if (EMO_OPTIONS::instance ()->alloc_task_per_proxy_ == 1) + return create_task (EMO_OPTIONS::instance ()->mt_listener_eval_, + EMO_OPTIONS::instance ()->listener_threads_, + ACE_TRY_ENV); else - ACE_NEW_THROW_EX (task, - TAO_Notify_Worker_Task (), - CORBA::NO_MEMORY ()); - return task; + return prealloc_listener_eval_task_; } TAO_Notify_Worker_Task* TAO_Notify_Default_EMO_Factory::create_dispatching_task (CORBA::Environment &ACE_TRY_ENV) { - TAO_Notify_Worker_Task* task; + if (EMO_OPTIONS::instance ()->alloc_task_per_proxy_ == 1) + return create_task (EMO_OPTIONS::instance ()->mt_dispatching_, + EMO_OPTIONS::instance ()->dispatching_threads_, + ACE_TRY_ENV); + else + return prealloc_dispatching_task_; +} - int dispatching_threads_flags = - THR_SCHED_DEFAULT|THR_BOUND|THR_NEW_LWP; +TAO_Notify_Worker_Task* +TAO_Notify_Default_EMO_Factory::create_updates_task (CORBA::Environment &ACE_TRY_ENV) +{ + return create_task (EMO_OPTIONS::instance ()->asynch_updates_, ASYNCH_UPDATES_THREADS, ACE_TRY_ENV); +} - // int dispatching_threads_priority +void +TAO_Notify_Default_EMO_Factory::destroy_source_eval_task (TAO_Notify_Worker_Task* task) +{ + if (EMO_OPTIONS::instance ()->alloc_task_per_proxy_ == 1) + delete task; +} - // Later: give the user options to specify threads flags and thread priority for each task. +void +TAO_Notify_Default_EMO_Factory::destroy_listener_eval_task (TAO_Notify_Worker_Task* task) +{ + if (EMO_OPTIONS::instance ()->alloc_task_per_proxy_ == 1) + delete task; +} - if (this->mt_dispatching_ == 1) - ACE_NEW_THROW_EX (task, TAO_Notify_MT_Worker_Task (this->dispatching_threads_, - dispatching_threads_flags, - 0), - CORBA::NO_MEMORY ()); - else - ACE_NEW_THROW_EX (task, - TAO_Notify_Worker_Task (), - CORBA::NO_MEMORY ()); - return task; +void +TAO_Notify_Default_EMO_Factory::destroy_dispatching_task (TAO_Notify_Worker_Task* task) +{ + if (EMO_OPTIONS::instance ()->alloc_task_per_proxy_ == 1) + delete task; +} + +void +TAO_Notify_Default_EMO_Factory::destroy_lookup_task (TAO_Notify_Worker_Task* task) +{ + delete task; } void +TAO_Notify_Default_EMO_Factory::destroy_updates_task (TAO_Notify_Worker_Task* task) +{ + delete task; +} + + +void TAO_Notify_Default_EMO_Factory::print_values (void) { - ACE_DEBUG ((LM_DEBUG, - "EMO Factory = " - "mt_dispatching %d " - "mt_source_eval %d " - " mt_lookup %d " - " mt_listener_eval %d" - " dispatching_threads %d " - " source_threads %d " - " lookup_threads %d " - " listener_threads_ %d \n", - mt_dispatching_, - mt_source_eval_, - mt_lookup_, - mt_listener_eval_, - dispatching_threads_, - source_threads_, - lookup_threads_, - listener_threads_ + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + "EMO Factory = " + "mt_dispatching %d " + "mt_source_eval %d " + " mt_lookup %d " + " mt_listener_eval %d" + " dispatching_threads %d " + " source_threads %d " + " lookup_threads %d " + " listener_threads_ %d ", + " AsynchUpdates %d", + " AllocateTaskperProxy %d", + EMO_OPTIONS::instance ()->mt_dispatching_, + EMO_OPTIONS::instance ()->mt_source_eval_, + EMO_OPTIONS::instance ()->mt_lookup_, + EMO_OPTIONS::instance ()->mt_listener_eval_, + EMO_OPTIONS::instance ()->dispatching_threads_, + EMO_OPTIONS::instance ()->source_threads_, + EMO_OPTIONS::instance ()->lookup_threads_, + EMO_OPTIONS::instance ()->listener_threads_, + EMO_OPTIONS::instance ()->asynch_updates_, + EMO_OPTIONS::instance ()->alloc_task_per_proxy_ )); } @@ -241,3 +342,9 @@ ACE_STATIC_SVC_DEFINE (TAO_Notify_Default_EMO_Factory, ACE_FACTORY_DEFINE (TAO_Notify, TAO_Notify_Default_EMO_Factory) // **************************************************************** + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class ACE_Singleton<TAO_EMO_Options, ACE_Null_Mutex>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Singleton<TAO_EMO_Options, ACE_Null_Mutex> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.h index 9d47b7fe2b2..ee33d3d7633 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.h @@ -35,6 +35,25 @@ // purpose of an Abstract Factory is to have a single object that // returns consistently configured objects.... +class TAO_EMO_Options // Options read by service conf. +{ +public: + TAO_EMO_Options (void); + + // Params read via the svc.conf + CORBA::Boolean mt_dispatching_; + CORBA::Boolean mt_source_eval_; + CORBA::Boolean mt_lookup_; + CORBA::Boolean mt_listener_eval_; + CORBA::Boolean asynch_updates_; + CORBA::Boolean alloc_task_per_proxy_; + + int dispatching_threads_; + int source_threads_; + int lookup_threads_; + int listener_threads_; +}; + class TAO_Notify_Export TAO_Notify_Default_EMO_Factory : public TAO_Notify_EMO_Factory { public: @@ -63,20 +82,33 @@ class TAO_Notify_Export TAO_Notify_Default_EMO_Factory : public TAO_Notify_EMO_F virtual TAO_Notify_Worker_Task* create_lookup_task (CORBA::Environment &ACE_TRY_ENV); virtual TAO_Notify_Worker_Task* create_listener_eval_task ( CORBA::Environment &ACE_TRY_ENV); virtual TAO_Notify_Worker_Task* create_dispatching_task (CORBA::Environment &ACE_TRY_ENV); + virtual TAO_Notify_Worker_Task* create_updates_task (CORBA::Environment &ACE_TRY_ENV); + + virtual void destroy_source_eval_task (TAO_Notify_Worker_Task* task); + virtual void destroy_lookup_task (TAO_Notify_Worker_Task* task); + virtual void destroy_listener_eval_task (TAO_Notify_Worker_Task* task); + virtual void destroy_dispatching_task (TAO_Notify_Worker_Task* task); + virtual void destroy_updates_task (TAO_Notify_Worker_Task* task); + virtual void print_values (void); + int init_instance (); + protected: - // = Params read via the svc.conf - CORBA::Boolean mt_dispatching_; - CORBA::Boolean mt_source_eval_; - CORBA::Boolean mt_lookup_; - CORBA::Boolean mt_listener_eval_; + //= Protected Methods + TAO_Notify_Worker_Task* create_task (int mt, int tp_size,CORBA::Environment &ACE_TRY_ENV); + // Create a worker task, mt => is this a MT task, if so, tp_size is thread pool size. - int dispatching_threads_; - int source_threads_; - int lookup_threads_; - int listener_threads_; + int preallocate_tasks (void); + + //= Data Members + TAO_Notify_Worker_Task* prealloc_source_eval_task_; + TAO_Notify_Worker_Task* prealloc_listener_eval_task_; + TAO_Notify_Worker_Task* prealloc_dispatching_task_; }; +// Typedef an Options Singleton. +typedef ACE_Singleton <TAO_EMO_Options, ACE_Null_Mutex> EMO_OPTIONS; + ACE_STATIC_SVC_DECLARE (TAO_Notify_Default_EMO_Factory) ACE_FACTORY_DECLARE (TAO_Notify,TAO_Notify_Default_EMO_Factory) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_POA_Factory.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_POA_Factory.cpp index ba4d7fcb357..3f16e410f11 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_POA_Factory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_POA_Factory.cpp @@ -32,7 +32,6 @@ TAO_Notify_Default_POA_Factory::init (int /*argc*/, char* /*argv*/[]) int TAO_Notify_Default_POA_Factory::fini (void) { - ACE_DEBUG ((LM_DEBUG, "TAO_Notify_Default_POA_Factory::fini\n")); return 0; } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannel_i.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannel_i.cpp index c78f36407bf..53f3627ab87 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannel_i.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannel_i.cpp @@ -19,9 +19,10 @@ TAO_Notify_EventChannel_i::TAO_Notify_EventChannel_i (TAO_Notify_EventChannelFac :lock_ (0), destory_child_POAs_ (0), channel_factory_ (my_factory), - channel_objects_factory_ (TAO_Notify_Factory::get_channel_objects_factory ()), + channel_objects_factory_ (TAO_Notify_Factory:: + get_channel_objects_factory ()), poa_factory_ (TAO_Notify_Factory::get_poa_factory ()), - event_manager_objects_factory_ (TAO_Notify_Factory::get_event_manager_objects_factory ()), + event_manager_objects_factory_ (TAO_Notify_Factory::create_event_manager_objects_factory ()), default_op_ (CosNotifyChannelAdmin::OR_OP), default_id_ (0), event_listener_list_ (0) @@ -32,7 +33,8 @@ TAO_Notify_EventChannel_i::TAO_Notify_EventChannel_i (TAO_Notify_EventChannelFac // Implementation skeleton destructor TAO_Notify_EventChannel_i::~TAO_Notify_EventChannel_i (void) { - ACE_DEBUG ((LM_DEBUG,"in EC dtor\n")); + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG,"in EC dtor\n")); // Cleanup all resources.. delete this->event_manager_; @@ -41,6 +43,8 @@ TAO_Notify_EventChannel_i::~TAO_Notify_EventChannel_i (void) this->channel_factory_->event_channel_destroyed (this->channel_id_); channel_factory_->_remove_ref (); + + delete event_manager_objects_factory_; } void diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Manager.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Manager.cpp index 35cdd5e100a..17d5970b0ad 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Manager.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Manager.cpp @@ -14,12 +14,12 @@ ACE_RCSID(Notify, Notify_Event_Manager, "$Id$") -TAO_Notify_Event_Manager::TAO_Notify_Event_Manager (TAO_Notify_EventChannel_i* event_channel) +TAO_Notify_Event_Manager::TAO_Notify_Event_Manager (TAO_Notify_EventChannel_i* event_channel, TAO_Notify_EMO_Factory* emo_factory) :event_channel_ (event_channel), event_map_ (0), event_processor_ (0), updates_dispatching_task_ (0), - emo_factory_ (TAO_Notify_Factory::get_event_manager_objects_factory ()), + emo_factory_ (emo_factory), admin_properties_ (0) { } @@ -28,9 +28,10 @@ TAO_Notify_Event_Manager::~TAO_Notify_Event_Manager () { delete this->event_map_; delete this->event_processor_; - delete this->updates_dispatching_task_; delete this->lock_; delete this->admin_properties_; + + emo_factory_->destroy_updates_task (this->updates_dispatching_task_); } void @@ -53,8 +54,7 @@ TAO_Notify_Event_Manager::init (CORBA::Environment &ACE_TRY_ENV) ACE_CHECK; this->updates_dispatching_task_ = - // @@ add another method to RM - this->emo_factory_->create_dispatching_task (ACE_TRY_ENV); + this->emo_factory_->create_updates_task (ACE_TRY_ENV); ACE_CHECK; // Init the objects diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Manager.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Manager.h index 10e97a06903..e46c78d1947 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Manager.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Manager.h @@ -52,7 +52,8 @@ class TAO_Notify_Export TAO_Notify_Event_Manager public: // = Initialization and termination code. - TAO_Notify_Event_Manager (TAO_Notify_EventChannel_i* parent); + TAO_Notify_Event_Manager (TAO_Notify_EventChannel_i* parent, + TAO_Notify_EMO_Factory* emo_factory); // Constructor. ~TAO_Notify_Event_Manager (); @@ -104,6 +105,9 @@ class TAO_Notify_Export TAO_Notify_Event_Manager TAO_Notify_AdminProperties* admin_properties (void); // Get the Admin Properties. + TAO_Notify_EMO_Factory* resource_factory (void); + // Get the Resource Factory. + // = Event forwarding methods. void process_event (TAO_Notify_Event* event, TAO_Notify_EventSource* event_source, CORBA::Environment &ACE_TRY_ENV); // Delivers the event to listeners subscribed for <event> diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Manager.i b/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Manager.i index 27cccc42fb4..869f877e8d1 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Manager.i +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Manager.i @@ -73,3 +73,9 @@ TAO_Notify_Event_Manager::admin_properties (void) { return this->admin_properties_; } + +ACE_INLINE TAO_Notify_EMO_Factory* +TAO_Notify_Event_Manager::resource_factory (void) +{ + return this->emo_factory_; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Manager_Objects_Factory.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Manager_Objects_Factory.h index 0a9cc46af7d..2403e2a0d63 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Manager_Objects_Factory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Manager_Objects_Factory.h @@ -45,6 +45,8 @@ class TAO_Notify_Export TAO_Notify_EMO_Factory : public ACE_Service_Object // Factory interface for event manager and friends. // public: + virtual ~TAO_Notify_EMO_Factory (){}; + virtual TAO_Notify_Event_Manager* create_event_manager (TAO_Notify_EventChannel_i* channel, CORBA::Environment &ACE_TRY_ENV)= 0; // Create an event manager. @@ -58,9 +60,21 @@ class TAO_Notify_Export TAO_Notify_EMO_Factory : public ACE_Service_Object virtual TAO_Notify_Worker_Task* create_source_eval_task (CORBA::Environment &ACE_TRY_ENV)= 0; virtual TAO_Notify_Worker_Task* create_lookup_task (CORBA::Environment &ACE_TRY_ENV)= 0; virtual TAO_Notify_Worker_Task* create_listener_eval_task (CORBA::Environment &ACE_TRY_ENV)= 0; + virtual TAO_Notify_Worker_Task* create_dispatching_task (CORBA::Environment &ACE_TRY_ENV)= 0; + // Task that dispatches events. + virtual TAO_Notify_Worker_Task* create_updates_task (CORBA::Environment &ACE_TRY_ENV)= 0; + // Task that dispatches updates. + + // Destroy processing tasks. + virtual void destroy_source_eval_task (TAO_Notify_Worker_Task* task) = 0; + virtual void destroy_lookup_task (TAO_Notify_Worker_Task* task) = 0; + virtual void destroy_listener_eval_task (TAO_Notify_Worker_Task* task) = 0; + virtual void destroy_dispatching_task (TAO_Notify_Worker_Task* task) = 0; + virtual void destroy_updates_task (TAO_Notify_Worker_Task* task) = 0; virtual void print_values (void) = 0; + // bad hack. why is this here?! }; #include "ace/post.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Map.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Map.cpp index c4eedaf9431..71fa748a634 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Map.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Map.cpp @@ -14,11 +14,11 @@ ACE_RCSID(Notify, Notify_Event_Map, "$Id$") -TAO_Notify_Event_Map::TAO_Notify_Event_Map (void) +TAO_Notify_Event_Map::TAO_Notify_Event_Map (TAO_Notify_EMO_Factory* emo_factory) :default_subscription_list_ (0), subscription_change_listeners_ (0), publication_change_listeners_ (0), - emo_factory_ (TAO_Notify_Factory::get_event_manager_objects_factory ()), + emo_factory_ (emo_factory), collection_factory_ (TAO_Notify_Factory::get_collection_factory ()) { } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Map.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Map.h index d8098afb16a..be7769774e8 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Map.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Map.h @@ -49,7 +49,7 @@ class TAO_Notify_Export TAO_Notify_Event_Map // - Lists of subscriptions, publications update listeners. // public: - TAO_Notify_Event_Map (void); + TAO_Notify_Event_Map (TAO_Notify_EMO_Factory* emo_factory); // Constructor. virtual ~TAO_Notify_Event_Map (); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Processor.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Processor.cpp index 2483595a0be..30e6665b254 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Processor.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Event_Processor.cpp @@ -18,6 +18,7 @@ TAO_Notify_Event_Processor::TAO_Notify_Event_Processor (TAO_Notify_Event_Manager lookup_task_ (0), emo_factory_ (0) { + this->emo_factory_ = event_manager_->resource_factory (); } TAO_Notify_Event_Processor::~TAO_Notify_Event_Processor () @@ -28,9 +29,6 @@ TAO_Notify_Event_Processor::~TAO_Notify_Event_Processor () void TAO_Notify_Event_Processor::init (CORBA::Environment& ACE_TRY_ENV) { - this->emo_factory_ = - TAO_Notify_Factory::get_event_manager_objects_factory (); - this->lookup_task_ = this->emo_factory_->create_lookup_task (ACE_TRY_ENV); ACE_CHECK; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Factory.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Factory.cpp index 7423fa632d1..575f62c7fec 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Factory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Factory.cpp @@ -52,14 +52,12 @@ TAO_Notify_Factory::init (CORBA::Environment &ACE_TRY_ENV) ACE_Dynamic_Service <TAO_Notify_EMO_Factory>::instance (TAO_NOTIFY_DEF_EMO_FACTORY_NAME); if (emo_factory_ == 0) + ACE_DEBUG ((LM_DEBUG, "Unable to load Event Manager factory...\n")); + else { - ACE_NEW_THROW_EX (emo_factory_, - TAO_Notify_Default_EMO_Factory (), - CORBA::NO_MEMORY ()); + ACE_DEBUG ((LM_DEBUG, "Loaded Event Manager factory...\n")); + emo_factory_->print_values (); } - else - ACE_DEBUG ((LM_DEBUG, "Loaded EMO factory\n")); - emo_factory_->print_values (); } void @@ -87,9 +85,17 @@ TAO_Notify_Factory::get_collection_factory (void) } TAO_Notify_EMO_Factory* -TAO_Notify_Factory::get_event_manager_objects_factory (void) +TAO_Notify_Factory::create_event_manager_objects_factory (void) { - return TAO_Notify_Factory::emo_factory_; + ACE_DECLARE_NEW_CORBA_ENV; + TAO_Notify_Default_EMO_Factory* local_emo_fact; + ACE_NEW_THROW_EX (local_emo_fact, + TAO_Notify_Default_EMO_Factory (), + CORBA::NO_MEMORY ()); + + local_emo_fact->init_instance (); + // @@ check return value + return local_emo_fact; } // **************************************************************** diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Factory.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_Factory.h index 0dd144d8406..bc430df663d 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Factory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Factory.h @@ -56,7 +56,7 @@ class TAO_Notify_Export TAO_Notify_Factory static TAO_Notify_Collection_Factory* get_collection_factory (void); // Factory for all collections in the notify service. - static TAO_Notify_EMO_Factory* get_event_manager_objects_factory (void); + static TAO_Notify_EMO_Factory* create_event_manager_objects_factory (void); // The event manager objects. protected: diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Filter_i.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Filter_i.cpp index 096fd3152ef..f08f321d130 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Filter_i.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Filter_i.cpp @@ -112,8 +112,8 @@ TAO_Notify_Filter_i::add_constraints ( )) { int constraint_length = constraint_list.length (); - - ACE_DEBUG ((LM_DEBUG, "constraint_length = %d\n", constraint_length)); + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "constraint_length = %d\n", constraint_length)); // create the list that goes out. CosNotifyFilter::ConstraintInfoSeq* infoseq; ACE_NEW_THROW_EX (infoseq, diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_MT_Worker_Task.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_MT_Worker_Task.cpp index 8c9ce78ab3b..a141753fc3f 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_MT_Worker_Task.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_MT_Worker_Task.cpp @@ -98,7 +98,8 @@ TAO_Notify_MT_Worker_Task::svc (void) // Decrement the global event count. (*this->queue_length_)--; - ACE_DEBUG ((LM_DEBUG, "removing from queue\n")); + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "removing from queue\n")); TAO_Notify_Command *command = ACE_dynamic_cast(TAO_Notify_Command*, mb); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_ProxyConsumer_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_ProxyConsumer_T.cpp index 806cc2b5620..2b0c390dbf7 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_ProxyConsumer_T.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_ProxyConsumer_T.cpp @@ -35,7 +35,7 @@ TAO_Notify_ProxyConsumer<SERVANT_TYPE>::init (CosNotifyChannelAdmin::ProxyID pro // Create the task to forward filtering commands to: TAO_Notify_EMO_Factory* event_manager_objects_factory = - TAO_Notify_Factory::get_event_manager_objects_factory (); + event_manager_->resource_factory (); this->filter_eval_task_ = event_manager_objects_factory->create_source_eval_task (ACE_TRY_ENV); @@ -68,7 +68,10 @@ TAO_Notify_ProxyConsumer<SERVANT_TYPE>::~TAO_Notify_ProxyConsumer (void) this->filter_eval_task_->shutdown (ACE_TRY_ENV); ACE_CHECK; - delete this->filter_eval_task_; + TAO_Notify_EMO_Factory* event_manager_objects_factory = + event_manager_->resource_factory (); + + event_manager_objects_factory->destroy_listener_eval_task (this->filter_eval_task_); } template <class SERVANT_TYPE> CORBA::Boolean diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_ProxySupplier_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_ProxySupplier_T.cpp index 8271f4e3faa..15e6a791eac 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_ProxySupplier_T.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_ProxySupplier_T.cpp @@ -37,7 +37,7 @@ TAO_Notify_ProxySupplier<SERVANT_TYPE>::init (CosNotifyChannelAdmin::ProxyID pro this->lock_ = cof->create_proxy_supplier_lock (ACE_TRY_ENV); TAO_Notify_EMO_Factory* event_manager_objects_factory = - TAO_Notify_Factory::get_event_manager_objects_factory (); + event_manager_->resource_factory (); // Create the task to forward filtering/dispatching commands to: this->dispatching_task_ = @@ -80,8 +80,11 @@ TAO_Notify_ProxySupplier<SERVANT_TYPE>::~TAO_Notify_ProxySupplier (void) this->consumer_admin_->proxy_pushsupplier_destroyed (this->proxy_id_); consumer_admin_->_remove_ref (ACE_TRY_ENV); - delete this->dispatching_task_; - delete this->filter_eval_task_; + TAO_Notify_EMO_Factory* event_manager_objects_factory = + event_manager_->resource_factory (); + + event_manager_objects_factory->destroy_dispatching_task (this->dispatching_task_); + event_manager_objects_factory->destroy_source_eval_task (this->filter_eval_task_); } template <class SERVANT_TYPE> CORBA::Boolean diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Proxy_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Proxy_T.cpp index d853fac682d..c2c53c39848 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Proxy_T.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Proxy_T.cpp @@ -22,7 +22,8 @@ TAO_Notify_Proxy<SERVANT_TYPE>::TAO_Notify_Proxy (void) template <class SERVANT_TYPE> TAO_Notify_Proxy<SERVANT_TYPE>::~TAO_Notify_Proxy (void) { - ACE_DEBUG ((LM_DEBUG, "in ~TAO_Notify_Proxy\n")); + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "in ~TAO_Notify_Proxy\n")); } template <class SERVANT_TYPE> CORBA::ULong diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_SupplierAdmin_i.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_SupplierAdmin_i.cpp index 696285c0801..adb79d61658 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_SupplierAdmin_i.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_SupplierAdmin_i.cpp @@ -27,7 +27,8 @@ TAO_Notify_SupplierAdmin_i::TAO_Notify_SupplierAdmin_i (TAO_Notify_EventChannel_ // Implementation skeleton destructor TAO_Notify_SupplierAdmin_i::~TAO_Notify_SupplierAdmin_i () { - ACE_DEBUG ((LM_DEBUG,"in SA dtor\n")); + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG,"in SA dtor\n")); // Cleanup all resources.. ACE_DECLARE_NEW_CORBA_ENV; diff --git a/TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/README b/TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/README index a67a4a6dd9e..88b6a01e03c 100644 --- a/TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/README +++ b/TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/README @@ -18,7 +18,7 @@ a ""GREEN" event in a burst of RED and GREEN events alternatively. The subscriptions are specified in such a manner that the "slow" consumer only receives RED events while the "normal" consumer receives -the "GREEN" events, +the "GREEN" events, We use a TP reactor with 4 worker threads to allow upcalls to the normal consumers servant proceed without having to wait for the slow @@ -28,14 +28,14 @@ First Run the Notify Service in the reactive mode. Each participant in this (supplier and both consumers) are coupled together because all calls are sychronous. The 1 sec wait should affect throughput of all 3. - + Next use 2 Lookup thread and check performance. The throughput values should increase for the supplier and normal consumer but same for the slow consumer. Lastly, deploy a thread each at each proxy supplier. The Throughput of the normal consumer should increase dramatically. -This is because its data path is completely decoupled from the "slow consumer". +This is because its data path is completely decoupled from the "slow consumer". COMMAND LINE OPTIONS: -------------------- @@ -48,22 +48,18 @@ Test 1 ------ run $TAO_ROOT/orbsvcs/Notify_Service/Notify_Service -ORBsvcconf reactive.conf -run RedGreen_Test +run RedGreen_Test Test 2 ------ -run $TAO_ROOT/orbsvcs/Notify_Service/Notify_Service -ORBsvcconf lookup.conf -run RedGreen_Test +run $TAO_ROOT/orbsvcs/Notify_Service/Notify_Service -Notify_TPReactor 2 -ORBsvcconf lookup.conf +run RedGreen_Test Test 3 ------ -run $TAO_ROOT/orbsvcs/Notify_Service/Notify_Service -ORBsvcconf listener.conf -run RedGreen_Test - - - - +run $TAO_ROOT/orbsvcs/Notify_Service/Notify_Service -Notify_TPReactor 2 -ORBsvcconf listener.conf +run RedGreen_Test diff --git a/TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/listener.conf b/TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/listener.conf index c3b76ae1377..295f1824c1a 100644 --- a/TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/listener.conf +++ b/TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/listener.conf @@ -1 +1 @@ -static Notify_Default_Event_Manager_Objects_Factory "-MTListenerEval -Notify_TPReactor 4 " +static Notify_Default_Event_Manager_Objects_Factory "-AllocateTaskperProxy -MTListenerEval -ListenerThreads 1" diff --git a/TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/lookup.conf b/TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/lookup.conf index fffa47dcc43..198cc3b8472 100644 --- a/TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/lookup.conf +++ b/TAO/orbsvcs/tests/Notify/performance-tests/RedGreen/lookup.conf @@ -1 +1 @@ -static Notify_Default_Event_Manager_Objects_Factory "-MTLookup -LookupThreads 2" +static Notify_Default_Event_Manager_Objects_Factory "-AllocateTaskperProxy -MTLookup -LookupThreads 2" |