diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-06 01:43:25 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-06 01:43:25 +0000 |
commit | 215b47d92dea3613aa231ed162e577cf28e2ea74 (patch) | |
tree | 2ed4d6b4263a1476a5736009a8c1d14ce5893097 | |
parent | 48bdb23c1ae2285335102534e103fc06ad6b1cdf (diff) | |
download | ATCD-215b47d92dea3613aa231ed162e577cf28e2ea74.tar.gz |
ChangeLogTag:Mon Oct 5 20:35:28 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r-- | TAO/ChangeLog-98c | 25 | ||||
-rw-r--r-- | TAO/docs/releasenotes/TODO.html | 94 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Event/EC_Gateway.cpp | 265 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Event/EC_Gateway.h | 18 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp | 68 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.cpp | 21 |
6 files changed, 307 insertions, 184 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c index 44bcff2fdc0..aa39e20bc7a 100644 --- a/TAO/ChangeLog-98c +++ b/TAO/ChangeLog-98c @@ -1,3 +1,28 @@ +Mon Oct 5 20:35:28 1998 Carlos O'Ryan <coryan@cs.wustl.edu> + + * orbsvcs/orbsvcs/Event/EC_Gateway.h: + * orbsvcs/orbsvcs/Event/EC_Gateway.cpp: + The IIOP Gateways were not preserving the remote supplier IDs + properly. The current implementation uses a map of + ProxyPushConsumer on the "local" EC, using a different entry for + each supplier ID the local consumers show interest in. + At run-time the events are dispatched to the corresponding entry + in the map. + A special consumer is used for all the other events. + + * orbsvcs/orbsvcs/Event/Event_Channel.cpp: + Fixed a dead-lock during shutdown. + Also fixed some problems while updating the Observers; we held + the EC lock during the complete process, but it is fairly common + to make changes to the EC while the observers are beign updated. + + * orbsvcs/tests/EC_Multiple/EC_Multiple.cpp: + Some improvements on shutdown. + + * docs/releasenotes/TODO.html: + Updated the tasks corresponding to the changes in this ChangeLog + entry. + Mon Oct 05 18:54:31 1998 Irfan Pyarali <irfan@cs.wustl.edu> * orbsvcs/orbsvcs/Naming/CosNaming_i: Fixed the POA id generation diff --git a/TAO/docs/releasenotes/TODO.html b/TAO/docs/releasenotes/TODO.html index a818682e8f5..e37268cb181 100644 --- a/TAO/docs/releasenotes/TODO.html +++ b/TAO/docs/releasenotes/TODO.html @@ -48,51 +48,6 @@ </P> </LI> - <LI><P><B>EC:</B>If a Supplier disconnects while it has - consumers registered for it's Supplier_ID, - the consumers are not connected again even if the supplier - reconnects. - <BR>[STATUS] Carlos in working on this. - </P> - </LI> - - <LI><P><B>EC:</B>The <CODE>TAO_EC_Gateway_IIOP</CODE> class - receives events from a "remote" EC and pushes them on the - local EC. - The subscription and publication list for the Gateway are - the disjunction of the local EC consumer subscriptions. - Unfortunately this can result in multiple supplier_IDs for - the Gateway, the current implementation is not prepared to - handle this. - The Gateway must keep a list of suppliers, each one with a - different supplier id, - when it receives a remote event it should push the event - only to the right supplier. - It must also keep another supplier used for the events that - are of interest by their event type, regardless of their - supplier ID. - </P> - </LI> - - <LI><P><B>EC:</B>The Event Channel must be able to accept more - than one supplier with a given supplier ID, or at least we - should be able to configure the EC to work in such a mode. - This is required for some applications that treat the - supplier ID as a "supplier type". - </P> - </LI> - - <LI><P><B>EC:</B>The <CODE>TAO_EC_Gateway_IIOP</CODE> can be - required to subscribe for events by source, but the source - can be local instead of remote. - This is not a problem if the Event Channel supports multiple - supplier IDs, - but if it that's not the case, - we must check the local publications and remove those events - from the Gateway publication and subscription list. - </P> - </LI> - </OL> <HR> @@ -204,7 +159,7 @@ <LI> </OL> - <H4>New features</H4> + <H4>New features and Bug fixes</H4> <OL> <LI><B>EC:</B> Improve configuration support in the EC, give an example of a single threaded EC, support different dispatching @@ -322,7 +277,7 @@ class Foo { the event type into the mcast address was implemented. <BR>[STATUS] An advanced example that uses multiple mcast groups per process was developed; this example would be used - to test the required features for general mcast support. + To test the required features for general mcast support. <BR>[STATUS] The example is able to automatically join and leave multicast groups, as the consumer set on a local EC changes. @@ -336,6 +291,15 @@ class Foo { </P> </LI> + <LI><P><B>EC:</B>The <CODE>TAO_EC_Gateway_IIOP</CODE> can be + required to subscribe for events by source, but the source + can be local instead of remote. + This is not a problem since the Event Channel supports + multiple supplier IDs, + but we could check the local publications and remove those + events from the Gateway publication and subscription list. + </P> + </LI> <LI>Add support for multiple Profiles in the ORB (completing the IIOP 1.0 support) @@ -810,6 +774,42 @@ class Foo { <H3>Completed Tasks</H3> <OL> + <LI><P><B>EC:</B>The <CODE>TAO_EC_Gateway_IIOP</CODE> class + receives events from a "remote" EC and pushes them on the + local EC. + The subscription and publication list for the Gateway are + the disjunction of the local EC consumer subscriptions. + Unfortunately this can result in multiple supplier_IDs for + the Gateway, the current implementation is not prepared to + handle this. + The Gateway must keep a list of suppliers, each one with a + different supplier id, + when it receives a remote event it should push the event + only to the right supplier. + It must also keep another supplier used for the events that + are of interest by their event type, regardless of their + supplier ID. + <BR>[DONE] + </P> + </LI> + + <LI><P><B>EC:</B>The Event Channel must be able to accept more + than one supplier with a given supplier ID, or at least we + should be able to configure the EC to work in such a mode. + This is required for some applications that treat the + supplier ID as a "supplier type". + <BR>[DONE] + </P> + </LI> + + <LI><P><B>EC:</B>If a Supplier disconnects while it has + consumers registered for it's Supplier_ID, + the consumers are not connected again even if the supplier + reconnects. + <BR>[DONE] + </P> + </LI> + <LI><P>Further optimize memory allocation by using a memory pool for the incoming CDR stream. <BR>[DONE] The pool is configurable for the users that may diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.cpp index 157de523154..f12dcd8067b 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.cpp @@ -93,84 +93,34 @@ TAO_EC_Gateway_IIOP::init (RtecEventChannelAdmin::EventChannel_ptr rmt_ec, } void -TAO_EC_Gateway_IIOP::open (const RtecEventChannelAdmin::ConsumerQOS& sub, - const RtecEventChannelAdmin::SupplierQOS& pub, - CORBA::Environment &_env) -{ - TAO_TRY - { - // ACE_DEBUG ((LM_DEBUG, "ECG (%t) Open gateway\n")); - if (CORBA::is_nil (this->lcl_ec_.in ()) - || CORBA::is_nil (this->rmt_ec_.in ())) - return; - - // = Connect as a supplier to the local EC - RtecEventChannelAdmin::SupplierAdmin_var supplier_admin = - this->lcl_ec_->for_suppliers (TAO_TRY_ENV); - TAO_CHECK_ENV; - - this->consumer_proxy_ = - supplier_admin->obtain_push_consumer (TAO_TRY_ENV); - TAO_CHECK_ENV; - - RtecEventComm::PushSupplier_var supplier_ref = - this->supplier_._this (TAO_TRY_ENV); - TAO_CHECK_ENV; - - //ACE_DEBUG ((LM_DEBUG, "ECG (%t) Gateway/Supplier ")); - //ACE_SupplierQOS_Factory::debug (pub); - - this->consumer_proxy_->connect_push_supplier (supplier_ref.in (), - pub, - TAO_TRY_ENV); - TAO_CHECK_ENV; - - RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin = - this->rmt_ec_->for_consumers (TAO_TRY_ENV); - TAO_CHECK_ENV; - - this->supplier_proxy_ = - consumer_admin->obtain_push_supplier (TAO_TRY_ENV); - TAO_CHECK_ENV; - - RtecEventComm::PushConsumer_var consumer_ref = - this->consumer_._this (TAO_TRY_ENV); - TAO_CHECK_ENV; - - //ACE_DEBUG ((LM_DEBUG, "ECG (%t) Gateway/Consumer ")); - //ACE_ConsumerQOS_Factory::debug (sub); - - this->supplier_proxy_->connect_push_consumer (consumer_ref.in (), - sub, - TAO_TRY_ENV); - TAO_CHECK_ENV; - } - TAO_CATCHANY - { - TAO_TRY_ENV.print_exception ("TAO_EC_Gateway_IIOP::open"); - this->consumer_proxy_ = 0; - this->supplier_proxy_ = 0; - - TAO_RETHROW; - } - TAO_ENDTRY; -} - -void TAO_EC_Gateway_IIOP::close (CORBA::Environment &env) { // ACE_DEBUG ((LM_DEBUG, "ECG (%t) Closing gateway\n")); - if (CORBA::is_nil (this->consumer_proxy_.in ()) - || CORBA::is_nil (this->supplier_proxy_.in ())) + if (CORBA::is_nil (this->supplier_proxy_.in ())) return; - this->consumer_proxy_->disconnect_push_consumer (env); - if (env.exception () != 0) return; - this->consumer_proxy_ = 0; + if (this->consumer_proxy_map_.current_size () > 0) + { + for (Consumer_Map_Iterator j = this->consumer_proxy_map_.begin (); + j != this->consumer_proxy_map_.end (); + ++j) + { + (*j).int_id_->disconnect_push_consumer (env); + CORBA::release ((*j).int_id_); + TAO_CHECK_ENV_RETURN_VOID (env); + } + this->consumer_proxy_map_.close (); + } + + this->default_consumer_proxy_->disconnect_push_consumer (env); + TAO_CHECK_ENV_RETURN_VOID (env); + this->default_consumer_proxy_ = + RtecEventChannelAdmin::ProxyPushConsumer::_nil (); this->supplier_proxy_->disconnect_push_supplier (env); - if (env.exception () != 0) return; - this->supplier_proxy_ = 0; + TAO_CHECK_ENV_RETURN_VOID (env); + this->supplier_proxy_ = + RtecEventChannelAdmin::ProxyPushSupplier::_nil (); } void @@ -183,27 +133,142 @@ TAO_EC_Gateway_IIOP::update_consumer (const RtecEventChannelAdmin::ConsumerQOS& if (c_qos.dependencies.length () <= 1) return; - RtecEventChannelAdmin::ConsumerQOS sub = c_qos; - RtecEventChannelAdmin::SupplierQOS pub; - pub.publications.length (sub.dependencies.length () - 1); - pub.is_gateway = 1; + // ACE_DEBUG ((LM_DEBUG, "ECG (%t) Open gateway\n")); + if (CORBA::is_nil (this->lcl_ec_.in ()) + || CORBA::is_nil (this->rmt_ec_.in ())) + return; + // = Connect as a supplier to the local EC + RtecEventChannelAdmin::SupplierAdmin_var supplier_admin = + this->lcl_ec_->for_suppliers (env); + TAO_CHECK_ENV_RETURN_VOID (env); + + this->default_consumer_proxy_ = + supplier_admin->obtain_push_consumer (env); + TAO_CHECK_ENV_RETURN_VOID (env); + + // Change the RT_Info in the consumer QoS. + // On the same loop we discover the subscriptions by event source, + // and fill the consumer proxy map. + RtecEventChannelAdmin::ConsumerQOS sub = c_qos; for (CORBA::ULong i = 0; i < sub.dependencies.length (); ++i) { sub.dependencies[i].rt_info = this->rmt_info_; + + RtecEventChannelAdmin::ProxyPushConsumer_ptr proxy = 0; + RtecEventComm::EventSourceID sid = + sub.dependencies[i].event.header.source; + if (sid != 0 + && this->consumer_proxy_map_.find (sid, proxy) == -1) + { + proxy = supplier_admin->obtain_push_consumer (env); + TAO_CHECK_ENV_RETURN_VOID (env); + this->consumer_proxy_map_.bind (sid, proxy); + } + } + + // Obtain a reference to our supplier personality... + RtecEventComm::PushSupplier_var supplier_ref = + this->supplier_._this (env); + TAO_CHECK_ENV_RETURN_VOID (env); + + if (this->consumer_proxy_map_.current_size () > 0) + { + // For each subscription by source build the set of publications + // (they may several, by type, for instance) and connect to the + // consumer proxy. + for (Consumer_Map_Iterator j = this->consumer_proxy_map_.begin (); + j != this->consumer_proxy_map_.end (); + ++j) + { + RtecEventChannelAdmin::SupplierQOS pub; + pub.publications.length (sub.dependencies.length () - 1); + pub.is_gateway = 1; + int c = 0; + + RtecEventComm::EventSourceID sid = (*j).ext_id_; + for (CORBA::ULong k = 0; k < sub.dependencies.length (); ++k) + { + const RtecEventComm::EventHeader& h = + sub.dependencies[k].event.header; + if (h.source != sid + || (0 <= h.type + && h.type < ACE_ES_EVENT_UNDEFINED)) + continue; + pub.publications[c].event.header = h; + pub.publications[c].dependency_info.dependency_type = + RtecScheduler::TWO_WAY_CALL; + pub.publications[c].dependency_info.number_of_calls = 1; + pub.publications[c].dependency_info.rt_info = this->lcl_info_; + c++; + } + if (c == 0) + continue; + + pub.publications.length (c); + (*j).int_id_->connect_push_supplier (supplier_ref.in (), + pub, + env); + TAO_CHECK_ENV_RETURN_VOID (env); + } } - for (CORBA::ULong j = 0; j < pub.publications.length (); ++j) + // Also build the subscriptions that are *not* by source and connect + // to the default consumer proxy. + RtecEventChannelAdmin::SupplierQOS pub; + pub.publications.length (sub.dependencies.length () - 1); + pub.is_gateway = 1; + int c = 0; + for (CORBA::ULong k = 0; k < sub.dependencies.length (); ++k) { - pub.publications[j].event.header = sub.dependencies[j + 1].event.header; - pub.publications[j].event.header.creation_time = ORBSVCS_Time::zero; - pub.publications[j].dependency_info.dependency_type = - RtecScheduler::TWO_WAY_CALL; - pub.publications[j].dependency_info.number_of_calls = 1; - pub.publications[j].dependency_info.rt_info = this->lcl_info_; + const RtecEventComm::EventHeader& h = + sub.dependencies[k].event.header; + RtecEventComm::EventSourceID sid = h.source; + if (sid != 0 + || (0 <= h.type + && h.type < ACE_ES_EVENT_UNDEFINED)) + continue; + pub.publications[c].event.header = h; + pub.publications[c].event.header.creation_time = ORBSVCS_Time::zero; + pub.publications[c].dependency_info.dependency_type = + RtecScheduler::TWO_WAY_CALL; + pub.publications[c].dependency_info.number_of_calls = 1; + pub.publications[c].dependency_info.rt_info = this->lcl_info_; + c++; } + if (c > 0) + { + pub.publications.length (c); + this->default_consumer_proxy_->connect_push_supplier (supplier_ref.in (), + pub, + env); + TAO_CHECK_ENV_RETURN_VOID (env); + } + + + //ACE_DEBUG ((LM_DEBUG, "ECG (%t) Gateway/Supplier ")); + //ACE_SupplierQOS_Factory::debug (pub); + + RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin = + this->rmt_ec_->for_consumers (env); + TAO_CHECK_ENV_RETURN_VOID (env); + + this->supplier_proxy_ = + consumer_admin->obtain_push_supplier (env); + TAO_CHECK_ENV_RETURN_VOID (env); + + RtecEventComm::PushConsumer_var consumer_ref = + this->consumer_._this (env); + TAO_CHECK_ENV_RETURN_VOID (env); + + //ACE_DEBUG ((LM_DEBUG, "ECG (%t) Gateway/Consumer ")); + //ACE_ConsumerQOS_Factory::debug (sub); + + this->supplier_proxy_->connect_push_consumer (consumer_ref.in (), + sub, + env); + TAO_CHECK_ENV_RETURN_VOID (env); - this->open (sub, pub, env); } void @@ -231,7 +296,7 @@ TAO_EC_Gateway_IIOP::disconnect_push_supplier (CORBA::Environment &) void TAO_EC_Gateway_IIOP::push (const RtecEventComm::EventSet &events, - CORBA::Environment & _env) + CORBA::Environment & env) { //ACE_DEBUG ((LM_DEBUG, "TAO_EC_Gateway_IIOP::push - ")); @@ -245,24 +310,26 @@ TAO_EC_Gateway_IIOP::push (const RtecEventComm::EventSet &events, // @@ TODO, there is an extra data copy here, we should do the event // modification without it and only compact the necessary events. - int count = 0; - RtecEventComm::EventSet out (events.length ()); - for (u_int i = 0; i < events.length (); ++i) + RtecEventComm::EventSet out (1); + out.length (1); + for (CORBA::ULong i = 0; i < events.length (); ++i) { - //ACE_DEBUG ((LM_DEBUG, "type = %d ", events[i].type_)); - if (events[i].header.ttl > 0) + if (events[i].header.ttl == 0) + continue; + + RtecEventChannelAdmin::ProxyPushConsumer_ptr proxy = 0; + RtecEventComm::EventSourceID sid = events[i].header.source; + if (sid == 0 + || this->consumer_proxy_map_.find (sid, proxy) == -1) { - count++; - out.length (count); - out[count - 1] = events[i]; - out[count - 1].header.ttl--; + // If the source is not in our map we have to use the + // default consumer proxy. + proxy = this->default_consumer_proxy_; } - } - //ACE_DEBUG ((LM_DEBUG, "count = %d\n", count)); - - if (count > 0) - { - this->consumer_proxy_->push (out, _env); + out[0] = events[i]; + out[0].header.ttl--; + proxy->push (out, env); + TAO_CHECK_ENV_RETURN_VOID (env); } } diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.h b/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.h index 0141dab75b0..46a1ca2233e 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.h @@ -62,11 +62,6 @@ public: virtual ~TAO_EC_Gateway (void); // Destructor - virtual void open (const RtecEventChannelAdmin::ConsumerQOS& subscriptions, - const RtecEventChannelAdmin::SupplierQOS& publications, - CORBA::Environment& env) = 0; - // This method is invoked to create the first connection to the ECs - virtual void close (CORBA::Environment& env) = 0; // The gateway must disconnect from all the relevant event channels, // or any other communication media (such as multicast groups). @@ -143,9 +138,6 @@ public: // Disconnect and shutdown the gateway // The following methods are documented in the base class. - virtual void open (const RtecEventChannelAdmin::ConsumerQOS& subscriptions, - const RtecEventChannelAdmin::SupplierQOS& publications, - CORBA::Environment &_env); virtual void close (CORBA::Environment& _env); virtual void update_consumer (const RtecEventChannelAdmin::ConsumerQOS& sub, CORBA::Environment& env); @@ -167,8 +159,14 @@ private: ACE_PushSupplier_Adapter<TAO_EC_Gateway_IIOP> supplier_; // Our supplier personality.... - RtecEventChannelAdmin::ProxyPushConsumer_var consumer_proxy_; - // We talk to the EC (as a supplier) using this proxy. + // We use a different Consumer_Proxy + typedef ACE_Map_Manager<RtecEventComm::EventSourceID,RtecEventChannelAdmin::ProxyPushConsumer_ptr,ACE_Null_Mutex> Consumer_Map; + typedef ACE_Map_Iterator<RtecEventComm::EventSourceID,RtecEventChannelAdmin::ProxyPushConsumer_ptr,ACE_Null_Mutex> Consumer_Map_Iterator; + + Consumer_Map consumer_proxy_map_; + RtecEventChannelAdmin::ProxyPushConsumer_var default_consumer_proxy_; + // We talk to the EC (as a supplier) using either an per-supplier + // proxy or a generic proxy for the type only subscriptions. RtecEventChannelAdmin::ProxyPushSupplier_var supplier_proxy_; // We talk to the EC (as a consumer) using this proxy. diff --git a/TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp b/TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp index 5a5709a7205..2994cbfdf6c 100644 --- a/TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp @@ -584,18 +584,20 @@ ACE_EventChannel::destroy (CORBA::Environment &) { TAO_ORB_Core_instance ()->orb ()->shutdown (); - ACE_ES_GUARD ace_mon (lock_); - if (ace_mon.locked () == 0) - ACE_ERROR ((LM_ERROR, "ACE_EventChannel::destroy")); + { + ACE_GUARD (ACE_ES_MUTEX, ace_mon, this->lock_); - if (destroyed_ != 0) - return; + if (this->destroyed_ != 0) + return; - destroyed_ = 1; - ACE_DEBUG ((LM_DEBUG, "EC (%t) Event Channel shutting down.\n")); + this->destroyed_ = 1; + ACE_DEBUG ((LM_DEBUG, "EC (%t) Event Channel shutting down.\n")); + + } + this->cleanup_observers (); // Send a shutdown message through the modules. - supplier_module_->shutdown (); + this->supplier_module_->shutdown (); #if 0 // Flush all messages in the channel. @@ -697,20 +699,31 @@ ACE_EventChannel::del_gateway (TAO_EC_Gateway* gw, void ACE_EventChannel::update_consumer_gwys (CORBA::Environment& _env) { - TAO_GUARD_THROW (ACE_ES_MUTEX, ace_mon, this->lock_, _env, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR()); + Observer_Map observers; + { + TAO_GUARD_THROW (ACE_ES_MUTEX, ace_mon, this->lock_, _env, + RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR()); - if (this->observers_.current_size () == 0 - || this->state_ == ACE_EventChannel::SHUTDOWN) - return; + if (this->observers_.current_size () == 0 + || this->state_ == ACE_EventChannel::SHUTDOWN) + return; + + observers.open (this->observers_.current_size ()); + for (Observer_Map_Iterator i = this->observers_.begin (); + i != this->observers_.end (); + ++i) + { + observers.bind ((*i).ext_id_, (*i).int_id_); + } + } // ACE_DEBUG ((LM_DEBUG, // "EC (%t) Event_Channel::update_consumer_gwys\n")); RtecEventChannelAdmin::ConsumerQOS c_qos; this->consumer_module_->fill_qos (c_qos); - for (Observer_Map_Iterator i = this->observers_.begin (); - i != this->observers_.end (); + for (Observer_Map_Iterator i = observers.begin (); + i != observers.end (); ++i) { (*i).int_id_.observer->update_consumer (c_qos, _env); @@ -721,20 +734,31 @@ ACE_EventChannel::update_consumer_gwys (CORBA::Environment& _env) void ACE_EventChannel::update_supplier_gwys (CORBA::Environment& _env) { - TAO_GUARD_THROW (ACE_ES_MUTEX, ace_mon, this->lock_, _env, - RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR()); + Observer_Map observers; + { + TAO_GUARD_THROW (ACE_ES_MUTEX, ace_mon, this->lock_, _env, + RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR()); - if (this->observers_.current_size () == 0 - || this->state_ == ACE_EventChannel::SHUTDOWN) - return; + if (this->observers_.current_size () == 0 + || this->state_ == ACE_EventChannel::SHUTDOWN) + return; + + observers.open (this->observers_.current_size ()); + for (Observer_Map_Iterator i = this->observers_.begin (); + i != this->observers_.end (); + ++i) + { + observers.bind ((*i).ext_id_, (*i).int_id_); + } + } // ACE_DEBUG ((LM_DEBUG, // "EC (%t) Event_Channel::update_supplier_gwys\n")); RtecEventChannelAdmin::SupplierQOS s_qos; this->supplier_module_->fill_qos (s_qos); - for (Observer_Map_Iterator i = this->observers_.begin (); - i != this->observers_.end (); + for (Observer_Map_Iterator i = observers.begin (); + i != observers.end (); ++i) { (*i).int_id_.observer->update_supplier (s_qos, _env); diff --git a/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.cpp b/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.cpp index 5012041e405..e82c33272a1 100644 --- a/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.cpp +++ b/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.cpp @@ -450,6 +450,7 @@ Test_ECG::run (int argc, char* argv[]) ACE_DEBUG ((LM_DEBUG, "connected supplier\n")); + RtecEventChannelAdmin::Observer_Handle observer_handle; if (this->rmt_name_ != 0) { tv.set (5, 0); @@ -492,7 +493,11 @@ Test_ECG::run (int argc, char* argv[]) if (orb->run (&tv) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "orb->run"), -1); - ec_impl.add_gateway (&this->ecg_, TAO_TRY_ENV); + RtecEventChannelAdmin::Observer_ptr observer = + this->ecg_._this (TAO_TRY_ENV); + TAO_CHECK_ENV; + observer_handle = ec_impl.append_observer (observer, + TAO_TRY_ENV); TAO_CHECK_ENV; } @@ -527,6 +532,12 @@ Test_ECG::run (int argc, char* argv[]) ACE_DEBUG ((LM_DEBUG, "activate the EC\n")); + if (this->rmt_name_ != 0) + { + ec_impl.remove_observer (observer_handle, TAO_TRY_ENV); + TAO_CHECK_ENV; + } + // Create the EC internal threads ec_impl.activate (); @@ -580,11 +591,11 @@ Test_ECG::run (int argc, char* argv[]) this->schedule_file_); } + naming_context->unbind (channel_name, TAO_TRY_ENV); + TAO_CHECK_ENV; + if (this->rmt_name_ != 0) { - ec_impl.del_gateway (&this->ecg_, TAO_TRY_ENV); - TAO_CHECK_ENV; - this->ecg_.close (TAO_TRY_ENV); TAO_CHECK_ENV; this->ecg_.shutdown (TAO_TRY_ENV); @@ -601,8 +612,6 @@ Test_ECG::run (int argc, char* argv[]) if (orb->run (&tv) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "orb->run"), -1); - naming_context->unbind (channel_name, TAO_TRY_ENV); - TAO_CHECK_ENV; } TAO_CATCH (CORBA::SystemException, sys_ex) { |