#include <EC_Per_Supplier_Filter.h>
Inheritance diagram for TAO_EC_Per_Supplier_Filter:
This is a filtering strategy for the suppliers. In this particular case we keep a collection of the consumers that could potentially be interested in any event generated by a particular supplier. This minimizes the amount of consumers touched by the EC when dispatching an event.
Definition at line 44 of file EC_Per_Supplier_Filter.h.
|
Constructor.
Definition at line 23 of file EC_Per_Supplier_Filter.cpp. References TAO_EC_Event_Channel_Base::create_proxy_collection().
00024 : event_channel_ (ec), 00025 consumer_ (0), 00026 refcnt_ (1) 00027 { 00028 this->event_channel_->create_proxy_collection (this->collection_); 00029 } |
|
Destructor.
Definition at line 31 of file EC_Per_Supplier_Filter.cpp. References TAO_EC_Event_Channel_Base::destroy_proxy_collection().
00032 { 00033 this->event_channel_->destroy_proxy_collection (this->collection_); 00034 this->collection_ = 0; 00035 } |
|
Implements TAO_EC_Supplier_Filter. Definition at line 174 of file EC_Per_Supplier_Filter.cpp. References ACE_GUARD_RETURN, TAO_EC_Supplier_Filter_Builder::destroy(), refcnt_, TAO_EC_Event_Channel_Base::supplier_filter_builder(), and TAO_SYNCH_MUTEX.
00175 { 00176 { 00177 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); 00178 00179 this->refcnt_--; 00180 if (this->refcnt_ != 0) 00181 return this->refcnt_; 00182 } 00183 this->event_channel_->supplier_filter_builder ()->destroy (this); 00184 return 0; 00185 } |
|
Increment and decrement the reference count, locking must be provided by the user. Implements TAO_EC_Supplier_Filter. Definition at line 165 of file EC_Per_Supplier_Filter.cpp. References ACE_GUARD_RETURN, refcnt_, and TAO_SYNCH_MUTEX.
00166 { 00167 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); 00168 00169 this->refcnt_++; 00170 return this->refcnt_; 00171 } |
|
Whenever a ProxyPushConsumer is initialized it calls this method to inform the Supplier_Filter of its identity. Strategies that do not keep ProxyPushConsumer specific information, or that are shared between multiple ProxyPushConsumers can ignore this message. Implements TAO_EC_Supplier_Filter. Definition at line 38 of file EC_Per_Supplier_Filter.cpp. References ACE_GUARD, and TAO_SYNCH_MUTEX.
|
|
Concrete implementations can use this methods to keep track of the consumers interested in this events. Implements TAO_EC_Supplier_Filter. Definition at line 69 of file EC_Per_Supplier_Filter.cpp. References ACE_DEBUG, ACE_GUARD, TAO_EC_ProxyPushSupplier::can_match(), TAO_ESF_Proxy_Collection< TAO_EC_ProxyPushSupplier >::connected(), RtecEventComm::Event::header, LM_DEBUG, RtecEventChannelAdmin::SupplierQOS::publications, TAO_EC_ProxyPushConsumer::publications_i(), and TAO_SYNCH_MUTEX.
00070 { 00071 ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); 00072 00073 if (this->consumer_ == 0) 00074 return; 00075 00076 const RtecEventChannelAdmin::SupplierQOS& pub = 00077 this->consumer_->publications_i (); 00078 00079 for (CORBA::ULong j = 0; j < pub.publications.length (); ++j) 00080 { 00081 const RtecEventComm::Event& event = 00082 pub.publications[j].event; 00083 00084 #if TAO_EC_ENABLE_DEBUG_MESSAGES 00085 ACE_DEBUG ((LM_DEBUG, "Connecting consumer <%x> to <%x>, " 00086 "trying event <%d:%d> ", 00087 supplier, this, 00088 event.header.source, event.header.type)); 00089 #endif /* TAO_EC_ENABLED_DEBUG_MESSAGES */ 00090 if (supplier->can_match (event.header)) 00091 { 00092 #if TAO_EC_ENABLE_DEBUG_MESSAGES 00093 ACE_DEBUG ((LM_DEBUG, " matched\n")); 00094 #endif /* TAO_EC_ENABLED_DEBUG_MESSAGES */ 00095 this->collection_->connected (supplier); 00096 return; 00097 } 00098 #if TAO_EC_ENABLE_DEBUG_MESSAGES 00099 ACE_DEBUG ((LM_DEBUG, " not matched\n")); 00100 #endif /* TAO_EC_ENABLED_DEBUG_MESSAGES */ 00101 } 00102 } |
|
Implements TAO_EC_Supplier_Filter. Definition at line 134 of file EC_Per_Supplier_Filter.cpp. References TAO_ESF_Proxy_Collection< TAO_EC_ProxyPushSupplier >::disconnected().
00135 { 00136 this->collection_->disconnected (supplier); 00137 } |
|
The ProxyPushConsumer delegates on this class to actually send the event. Implements TAO_EC_Supplier_Filter. Definition at line 146 of file EC_Per_Supplier_Filter.cpp. References RtecEventComm::EventSet, TAO_EC_Scheduling_Strategy::schedule_event(), and TAO_EC_Event_Channel_Base::scheduling_strategy().
00148 { 00149 TAO_EC_Scheduling_Strategy* scheduling_strategy = 00150 this->event_channel_->scheduling_strategy (); 00151 scheduling_strategy->schedule_event (event, 00152 consumer, 00153 this); 00154 } |
|
Events are first scheduled by the TAO_EC_Scheduling_Strategy, and then pushed through this class again. Implements TAO_EC_Supplier_Filter. Definition at line 157 of file EC_Per_Supplier_Filter.cpp. References RtecEventComm::EventSet, and TAO_ESF_Proxy_Collection< TAO_EC_ProxyPushSupplier >::for_each().
00159 { 00160 TAO_EC_Filter_Worker worker (event, event_info); 00161 this->collection_->for_each (&worker); 00162 } |
|
Implements TAO_EC_Supplier_Filter. Definition at line 105 of file EC_Per_Supplier_Filter.cpp. References ACE_GUARD, TAO_EC_ProxyPushSupplier::can_match(), TAO_ESF_Proxy_Collection< TAO_EC_ProxyPushSupplier >::connected(), TAO_ESF_Proxy_Collection< TAO_EC_ProxyPushSupplier >::disconnected(), RtecEventComm::Event::header, RtecEventChannelAdmin::SupplierQOS::publications, TAO_EC_ProxyPushConsumer::publications_i(), and TAO_SYNCH_MUTEX.
00106 { 00107 ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); 00108 00109 if (this->consumer_ == 0) 00110 return; 00111 00112 const RtecEventChannelAdmin::SupplierQOS& pub = 00113 this->consumer_->publications_i (); 00114 00115 for (CORBA::ULong j = 0; j < pub.publications.length (); ++j) 00116 { 00117 const RtecEventComm::Event& event = 00118 pub.publications[j].event; 00119 00120 // ACE_DEBUG ((LM_DEBUG, "Trying %d:%d in %x\n", 00121 // event.header.source, event.header.type, 00122 // this)); 00123 if (supplier->can_match (event.header)) 00124 { 00125 // ACE_DEBUG ((LM_DEBUG, " matched %x\n", supplier)); 00126 this->collection_->connected (supplier); 00127 return; 00128 } 00129 } 00130 this->collection_->disconnected (supplier); 00131 } |
|
The event channel is shutting down.
Implements TAO_EC_Supplier_Filter. Definition at line 140 of file EC_Per_Supplier_Filter.cpp. References TAO_ESF_Proxy_Collection< TAO_EC_ProxyPushSupplier >::shutdown(). Referenced by unbind().
00141 { 00142 this->collection_->shutdown (); 00143 } |
|
Wheneve a ProxyPushConsumer is about to be destroyed it calls this method to inform the Supplier_Filter that it should release any resources related to it. Supplier_Filter strategies that are bound to a particular ProxyConsumer can use this opportunity to destroy themselves; filter strategies that do not keep ProxyPushConsumer specific information can simply ignore the message. Implements TAO_EC_Supplier_Filter. Definition at line 49 of file EC_Per_Supplier_Filter.cpp. References ACE_GUARD, shutdown(), and TAO_SYNCH_MUTEX.
00050 { 00051 ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); 00052 00053 if (this->consumer_ == 0 || this->consumer_ != consumer) 00054 return; 00055 00056 this->consumer_ = 0; 00057 00058 try 00059 { 00060 this->shutdown (); 00061 } 00062 catch (const CORBA::Exception&) 00063 { 00064 // @@ Ignore exceptions 00065 } 00066 } |
|
Keep the collection of proxies for the consumers that may be interested in our events. Definition at line 76 of file EC_Per_Supplier_Filter.h. |
|
The proxy for the supplier we are bound to.
Definition at line 72 of file EC_Per_Supplier_Filter.h. |
|
The event channel, used to locate the set of consumers.
Definition at line 69 of file EC_Per_Supplier_Filter.h. |
|
Locking.
Definition at line 82 of file EC_Per_Supplier_Filter.h. |
|
Reference counting.
Definition at line 79 of file EC_Per_Supplier_Filter.h. Referenced by _decr_refcnt(), and _incr_refcnt(). |