TAO_EC_ProxyPushSupplier Class Reference

ProxyPushSupplier. More...

#include <EC_ProxySupplier.h>

Inheritance diagram for TAO_EC_ProxyPushSupplier:

Inheritance graph
[legend]
Collaboration diagram for TAO_EC_ProxyPushSupplier:

Collaboration graph
[legend]
List of all members.

Public Types

typedef RtecEventChannelAdmin::ProxyPushSupplier Interface
typedef RtecEventChannelAdmin::ProxyPushSupplier_var _var_type
typedef RtecEventChannelAdmin::ProxyPushSupplier_ptr _ptr_type

Public Member Functions

 TAO_EC_ProxyPushSupplier (TAO_EC_Event_Channel_Base *event_channel, int validate_connection)
 Constructor...
virtual ~TAO_EC_ProxyPushSupplier (void)
 Destructor...
virtual void activate (RtecEventChannelAdmin::ProxyPushSupplier_ptr &proxy)=0
 Activate in the POA.
virtual void deactivate (void) throw ()
 Deactivate from the POA.
virtual void disconnect_push_supplier ()=0
 Disconnect this from.
CORBA::Boolean is_connected (void) const
 Return false if no consumer is connected...
CORBA::Boolean is_suspended (void) const
 Return true if it is suspended.
RtecEventComm::PushConsumer_ptr consumer (void) const
const RtecEventChannelAdmin::ConsumerQOSsubscriptions (void) const
 The QoS (subscription) used to connect to the EC.
virtual void connected (TAO_EC_ProxyPushConsumer *consumer)
virtual void reconnected (TAO_EC_ProxyPushConsumer *consumer)
virtual void disconnected (TAO_EC_ProxyPushConsumer *consumer)
virtual void connected (TAO_EC_ProxyPushSupplier *supplier)
virtual void reconnected (TAO_EC_ProxyPushSupplier *supplier)
virtual void disconnected (TAO_EC_ProxyPushSupplier *supplier)
virtual void shutdown (void)
 The event channel is shutting down.
void push_to_consumer (RtecEventComm::PushConsumer_ptr consumer, const RtecEventComm::EventSet &event)
void reactive_push_to_consumer (RtecEventComm::PushConsumer_ptr consumer, const RtecEventComm::EventSet &event)
CORBA::Boolean consumer_non_existent (CORBA::Boolean_out disconnected)
CORBA::ULong _incr_refcnt (void)
 Increment and decrement the reference count.
CORBA::ULong _decr_refcnt (void)
virtual int filter (const RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info)
virtual int filter_nocopy (RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info)
virtual void push (const RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info)
virtual void push_nocopy (RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info)
virtual void clear (void)
virtual CORBA::ULong max_event_size (void) const
 Returns the maximum size of the events pushed by this filter.
virtual int can_match (const RtecEventComm::EventHeader &header) const
virtual int add_dependencies (const RtecEventComm::EventHeader &header, const TAO_EC_QOS_Info &qos_info)

Protected Member Functions

void consumer (RtecEventComm::PushConsumer_ptr consumer)
void consumer_i (RtecEventComm::PushConsumer_ptr consumer)
void suspend_connection_i (void)
void resume_connection_i (void)
void suspend_connection_locked (void)
void resume_connection_locked (void)
CORBA::Boolean is_connected_i (void) const
 The private version (without locking) of is_connected().
void cleanup_i (void)
 Release the child and the consumer.

Protected Attributes

TAO_EC_Event_Channel_Baseevent_channel_
 The Event Channel that owns this object.
ACE_Locklock_
 The locking strategy.
CORBA::ULong refcount_
 The reference count.
RtecEventComm::PushConsumer_var consumer_
 The consumer....
CORBA::Boolean suspended_
 Is this consumer suspended?
RtecEventChannelAdmin::ConsumerQOS qos_
 The subscription and QoS information...
PortableServer::POA_var default_POA_
 Store the default POA.
TAO_EC_Filterchild_
 The filter object.
int consumer_validate_connection_
 Validate the connection to consumer on connect.

Private Member Functions

virtual void refcount_zero_hook (void)
 Template method hooks.
virtual void pre_dispatch_hook (RtecEventComm::EventSet &)
virtual PortableServer::ObjectId object_id (void)=0

Detailed Description

ProxyPushSupplier.

Implement the RtecEventChannelAdmin::ProxyPushSupplier interface, remember that this class is used to communicate with a PushConsumer, so, in effect, this is the ambassador for a consumer inside the event channel.

Memory Management

It does not assume ownership of the TAO_EC_Dispatching object. It makes a copy of the ConsumerQOS and the consumer object reference.

Locking

Locking is strategized, the event channel acts as a factory for the locking strategies.

Todo:
We don't need to provide a trivial filter, the object itself could short-circuit the filter() ---> push() cycle when the EC is properly configured, we need to explore this...

Definition at line 56 of file EC_ProxySupplier.h.


Member Typedef Documentation

typedef RtecEventChannelAdmin::ProxyPushSupplier_ptr TAO_EC_ProxyPushSupplier::_ptr_type

Definition at line 61 of file EC_ProxySupplier.h.

typedef RtecEventChannelAdmin::ProxyPushSupplier_var TAO_EC_ProxyPushSupplier::_var_type

Definition at line 60 of file EC_ProxySupplier.h.

typedef RtecEventChannelAdmin::ProxyPushSupplier TAO_EC_ProxyPushSupplier::Interface

Definition at line 59 of file EC_ProxySupplier.h.


Constructor & Destructor Documentation

TAO_EC_ProxyPushSupplier::TAO_EC_ProxyPushSupplier ( TAO_EC_Event_Channel_Base event_channel,
int  validate_connection 
)

Constructor...

Definition at line 28 of file EC_ProxySupplier.cpp.

00029   : event_channel_ (ec),
00030     refcount_ (1),
00031     suspended_ (0),
00032     child_ (0),
00033     consumer_validate_connection_(validate_connection)
00034 {
00035   this->lock_ =
00036     this->event_channel_->create_supplier_lock ();
00037 
00038   this->default_POA_ =
00039     this->event_channel_->supplier_poa ();
00040 }

TAO_EC_ProxyPushSupplier::~TAO_EC_ProxyPushSupplier ( void   )  [virtual]

Destructor...

Definition at line 42 of file EC_ProxySupplier.cpp.

References cleanup_i(), TAO_EC_Event_Channel_Base::destroy_supplier_lock(), and event_channel_.

00043 {
00044   this->event_channel_->destroy_supplier_lock (this->lock_);
00045   this->cleanup_i ();
00046 }


Member Function Documentation

CORBA::ULong TAO_EC_ProxyPushSupplier::_decr_refcnt ( void   ) 

Definition at line 168 of file EC_ProxySupplier.cpp.

References ACE_GUARD_RETURN, refcount_, and refcount_zero_hook().

Referenced by TAO_EC_Default_ProxyPushSupplier::_remove_ref(), TAO_EC_Kokyu_Push_Command::~TAO_EC_Kokyu_Push_Command(), and TAO_EC_Push_Command::~TAO_EC_Push_Command().

00169 {
00170   {
00171     ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00172     --this->refcount_;
00173     if (this->refcount_ != 0)
00174       return this->refcount_;
00175   }
00176 
00177   this->refcount_zero_hook ();
00178   return 0;
00179 }

CORBA::ULong TAO_EC_ProxyPushSupplier::_incr_refcnt ( void   ) 

Increment and decrement the reference count.

Definition at line 154 of file EC_ProxySupplier.cpp.

References ACE_GUARD_RETURN, and refcount_.

Referenced by TAO_EC_Default_ProxyPushSupplier::_add_ref(), TAO_EC_Kokyu_Push_Command::TAO_EC_Kokyu_Push_Command(), and TAO_EC_Push_Command::TAO_EC_Push_Command().

00155 {
00156   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00157   return this->refcount_++;
00158 }

virtual void TAO_EC_ProxyPushSupplier::activate ( RtecEventChannelAdmin::ProxyPushSupplier_ptr &  proxy  )  [pure virtual]

Activate in the POA.

Implemented in TAO_EC_Default_ProxyPushSupplier.

int TAO_EC_ProxyPushSupplier::add_dependencies ( const RtecEventComm::EventHeader header,
const TAO_EC_QOS_Info qos_info 
) [virtual]

This is used for computing the scheduling dependencies:

Leaf filters check if the header could be matched, similar to the can_match() method; if it does they return 1, and 0 otherwise. Intermediate nodes always return 0.

This is used to build precise dependencies between the suppliers and the leaf of the filters that accept that event. Notice that only the nodes doing scheduling recurse through the list, so in configurations that do no require scheduling the recursion stops fairly soon.

Implements TAO_EC_Filter.

Definition at line 469 of file EC_ProxySupplier.cpp.

References ACE_GUARD_THROW_EX, TAO_EC_Filter::add_dependencies(), and child_.

Referenced by TAO_EC_Priority_Scheduling::add_proxy_supplier_dependencies(), and TAO_EC_Kokyu_Scheduling::add_proxy_supplier_dependencies().

00472 {
00473   ACE_GUARD_THROW_EX (
00474           ACE_Lock, ace_mon, *this->lock_,
00475           RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00476 
00477   return this->child_->add_dependencies (header,
00478                                          qos_info);
00479 }

int TAO_EC_ProxyPushSupplier::can_match ( const RtecEventComm::EventHeader header  )  const [virtual]

Returns 0 if an event with that header could never be accepted. This can used by the suppliers to filter out consumers that couldn't possibly be interested in their events. The rt_info and

Implements TAO_EC_Filter.

Definition at line 457 of file EC_ProxySupplier.cpp.

References ACE_GUARD_RETURN, TAO_EC_Filter::can_match(), and child_.

Referenced by TAO_EC_Per_Supplier_Filter::connected(), and TAO_EC_Per_Supplier_Filter::reconnected().

00459 {
00460   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00461 
00462   if (this->is_connected_i () == 0)
00463     return 0;
00464 
00465   return this->child_->can_match (header);
00466 }

void TAO_EC_ProxyPushSupplier::cleanup_i ( void   )  [protected]

Release the child and the consumer.

Definition at line 125 of file EC_ProxySupplier.cpp.

References child_, and consumer_.

Referenced by TAO_EC_Default_ProxyPushSupplier::connect_push_consumer(), TAO_EC_Default_ProxyPushSupplier::disconnect_push_supplier(), shutdown(), and ~TAO_EC_ProxyPushSupplier().

00126 {
00127   this->consumer_ =
00128     RtecEventComm::PushConsumer::_nil ();
00129 
00130   // @@ Why don't we have a destroy() method in the
00131   // filter_builder?
00132   delete this->child_;
00133   this->child_ = 0;
00134 }

void TAO_EC_ProxyPushSupplier::clear ( void   )  [virtual]

Clear any saved state, must reset and assume no events have been received.

Implements TAO_EC_Filter.

Definition at line 441 of file EC_ProxySupplier.cpp.

References ACE_GUARD, child_, and TAO_EC_Filter::clear().

00442 {
00443   ACE_GUARD (ACE_Lock, ace_mon, *this->lock_);
00444 
00445   this->child_->clear ();
00446 }

void TAO_EC_ProxyPushSupplier::connected ( TAO_EC_ProxyPushSupplier supplier  )  [virtual]

Usually implemented as no-ops, but some configurations may require this methods.

Definition at line 74 of file EC_ProxySupplier.cpp.

00075 {
00076 }

void TAO_EC_ProxyPushSupplier::connected ( TAO_EC_ProxyPushConsumer consumer  )  [virtual]

Concrete implementations can use this methods to keep track of the suppliers that publish its events.

Definition at line 49 of file EC_ProxySupplier.cpp.

References TAO_EC_Scheduling_Strategy::add_proxy_supplier_dependencies(), consumer(), event_channel_, and TAO_EC_Event_Channel_Base::scheduling_strategy().

Referenced by TAO_EC_Default_ProxyPushSupplier::disconnect_push_supplier(), and shutdown().

00050 {
00051   TAO_EC_Scheduling_Strategy *s =
00052     this->event_channel_->scheduling_strategy ();
00053 
00054   s->add_proxy_supplier_dependencies (this,
00055                                       consumer);
00056 }

ACE_INLINE void TAO_EC_ProxyPushSupplier::consumer ( RtecEventComm::PushConsumer_ptr  consumer  )  [protected]

Set the consumer, used by some implementations to change the policies used when invoking operations on the consumer.

Definition at line 77 of file EC_ProxySupplier.inl.

References ACE_GUARD, and consumer_i().

00078 {
00079   ACE_GUARD (ACE_Lock, ace_mon, *this->lock_);
00080 
00081   this->consumer_i (consumer);
00082 }

ACE_INLINE RtecEventComm::PushConsumer_ptr TAO_EC_ProxyPushSupplier::consumer ( void   )  const

Return the consumer object reference. It returns nil() if it has not connected yet.

Definition at line 64 of file EC_ProxySupplier.inl.

References ACE_GUARD_RETURN.

Referenced by connected(), consumer_non_existent(), TAO_EC_Default_ProxyPushSupplier::disconnect_push_supplier(), push(), push_nocopy(), reconnected(), and shutdown().

00065 {
00066   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00067   return RtecEventComm::PushConsumer::_duplicate (this->consumer_.in ());
00068 }

ACE_INLINE void TAO_EC_ProxyPushSupplier::consumer_i ( RtecEventComm::PushConsumer_ptr  consumer  )  [protected]

Definition at line 71 of file EC_ProxySupplier.inl.

References consumer_.

Referenced by consumer().

00072 {
00073   this->consumer_ = consumer;
00074 }

CORBA::Boolean TAO_EC_ProxyPushSupplier::consumer_non_existent ( CORBA::Boolean_out  disconnected  ) 

Invoke the _non_existent() pseudo-operation on the consumer. If it is disconnected then it returns true and sets the <disconnected> flag.

Definition at line 414 of file EC_ProxySupplier.cpp.

References CORBA::Object::_duplicate(), ACE_GUARD_THROW_EX, and consumer().

Referenced by TAO_EC_Ping_Consumer::work().

00416 {
00417   CORBA::Object_var consumer;
00418   {
00419     ACE_GUARD_THROW_EX (
00420         ACE_Lock, ace_mon, *this->lock_,
00421         CORBA::INTERNAL ());
00422 
00423     disconnected = 0;
00424     if (this->is_connected_i () == 0)
00425       {
00426         disconnected = 1;
00427         return 0;
00428       }
00429 
00430     consumer = CORBA::Object::_duplicate (this->consumer_.in ());
00431   }
00432 
00433 #if (TAO_HAS_MINIMUM_CORBA == 0)
00434   return consumer->_non_existent ();
00435 #else
00436   return 0;
00437 #endif /* TAO_HAS_MINIMUM_CORBA */
00438 }

void TAO_EC_ProxyPushSupplier::deactivate ( void   )  throw () [virtual]

Deactivate from the POA.

Definition at line 137 of file EC_ProxySupplier.cpp.

References default_POA_, and object_id().

Referenced by shutdown().

00138 {
00139   try
00140     {
00141       PortableServer::ObjectId id = this->object_id ();
00142       this->default_POA_->deactivate_object (id);
00143     }
00144   catch (const CORBA::Exception&)
00145     {
00146       // Exceptions here should not be propagated.  They usually
00147       // indicate that an object is beign disconnected twice, or some
00148       // race condition, but not a fault that the user needs to know
00149       // about.
00150     }
00151 }

virtual void TAO_EC_ProxyPushSupplier::disconnect_push_supplier (  )  [pure virtual]

Disconnect this from.

Implemented in TAO_EC_Default_ProxyPushSupplier, and TAO_EC_TPC_ProxyPushSupplier.

Referenced by TAO_EC_Reactive_ConsumerControl::consumer_not_exist(), and TAO_EC_Reactive_ConsumerControl::system_exception().

void TAO_EC_ProxyPushSupplier::disconnected ( TAO_EC_ProxyPushSupplier supplier  )  [virtual]

Definition at line 84 of file EC_ProxySupplier.cpp.

00085 {
00086 }

void TAO_EC_ProxyPushSupplier::disconnected ( TAO_EC_ProxyPushConsumer consumer  )  [virtual]

Definition at line 69 of file EC_ProxySupplier.cpp.

00070 {
00071 }

int TAO_EC_ProxyPushSupplier::filter ( const RtecEventComm::EventSet event,
TAO_EC_QOS_Info qos_info 
) [virtual]

Filter this event, returns 1 if the event is accepted, 0 otherwise. Notice that there are two versions of the method, if the event is not const then filter can take ownership of the event.

Attention:
There seems to be a disparity in interfaces: Supplier always push event sets of size 1 to the EC_ProxyPushSupplier, and EC_Filters do not implement handling of sets of more than 1 event. Then, why is this not enforced by the interface by having EC_ProxyPushSupplier take an event rather than a set?

Implements TAO_EC_Filter.

Definition at line 184 of file EC_ProxySupplier.cpp.

References ACE_GUARD_THROW_EX, child_, and TAO_EC_Filter::filter().

Referenced by TAO_EC_Timeout_Filter::push_to_proxy(), and TAO_EC_Filter_Worker::work().

00186 {
00187   Destroy_Guard auto_destroy (this->refcount_,
00188                               this->event_channel_,
00189                               this);
00190 
00191   int result = 0;
00192   {
00193     ACE_GUARD_THROW_EX (
00194             ACE_Lock, ace_mon, *this->lock_,
00195             RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00196 
00197     if (this->is_connected_i () == 0)
00198       return 0;
00199 
00200     result = this->child_->filter (event, qos_info);
00201   }
00202   return result;
00203 }

int TAO_EC_ProxyPushSupplier::filter_nocopy ( RtecEventComm::EventSet event,
TAO_EC_QOS_Info qos_info 
) [virtual]

Implements TAO_EC_Filter.

Definition at line 206 of file EC_ProxySupplier.cpp.

References ACE_GUARD_THROW_EX, child_, and TAO_EC_Filter::filter_nocopy().

00208 {
00209   Destroy_Guard auto_destroy (this->refcount_,
00210                               this->event_channel_,
00211                               this);
00212 
00213   int result = 0;
00214   {
00215     ACE_GUARD_THROW_EX (
00216             ACE_Lock, ace_mon, *this->lock_,
00217             RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00218 
00219     if (this->is_connected_i () == 0)
00220       return 0;
00221 
00222     result = this->child_->filter_nocopy (event, qos_info);
00223   }
00224   return result;
00225 }

ACE_INLINE CORBA::Boolean TAO_EC_ProxyPushSupplier::is_connected ( void   )  const

Return false if no consumer is connected...

Definition at line 48 of file EC_ProxySupplier.inl.

References ACE_GUARD_RETURN, and is_connected_i().

00049 {
00050   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00051 
00052   return this->is_connected_i ();
00053 }

ACE_INLINE CORBA::Boolean TAO_EC_ProxyPushSupplier::is_connected_i ( void   )  const [protected]

The private version (without locking) of is_connected().

Definition at line 42 of file EC_ProxySupplier.inl.

References CORBA::is_nil().

Referenced by TAO_EC_Default_ProxyPushSupplier::disconnect_push_supplier(), is_connected(), and shutdown().

00043 {
00044   return !CORBA::is_nil (this->consumer_.in ());
00045 }

ACE_INLINE CORBA::Boolean TAO_EC_ProxyPushSupplier::is_suspended ( void   )  const

Return true if it is suspended.

Definition at line 56 of file EC_ProxySupplier.inl.

References ACE_GUARD_RETURN, and suspended_.

00057 {
00058   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00059 
00060   return this->suspended_;
00061 }

CORBA::ULong TAO_EC_ProxyPushSupplier::max_event_size ( void   )  const [virtual]

Returns the maximum size of the events pushed by this filter.

Implements TAO_EC_Filter.

Definition at line 449 of file EC_ProxySupplier.cpp.

References ACE_GUARD_RETURN, child_, and TAO_EC_Filter::max_event_size().

00450 {
00451   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00452 
00453   return this->child_->max_event_size ();
00454 }

virtual PortableServer::ObjectId TAO_EC_ProxyPushSupplier::object_id ( void   )  [private, pure virtual]

Implemented in TAO_EC_Default_ProxyPushSupplier.

Referenced by deactivate().

void TAO_EC_ProxyPushSupplier::pre_dispatch_hook ( RtecEventComm::EventSet  )  [private, virtual]

Definition at line 273 of file EC_ProxySupplier.cpp.

Referenced by push(), and push_nocopy().

00274 {
00275 }

void TAO_EC_ProxyPushSupplier::push ( const RtecEventComm::EventSet event,
TAO_EC_QOS_Info qos_info 
) [virtual]

This is called by the children when they accept an event and which to pass it up. Notice that there are two versions of the method, if the event is not const then filter can take ownership of the event.

Implements TAO_EC_Filter.

Definition at line 228 of file EC_ProxySupplier.cpp.

References ACE_GUARD_THROW_EX, child_, TAO_EC_Filter::clear(), consumer(), TAO_EC_Event_Channel_Base::dispatching(), event_channel_, pre_dispatch_hook(), TAO_EC_Dispatching::push(), and TAO_EC_Unlock.

00230 {
00231   // The mutex is already held by the caller (usually the filter()
00232   // method)
00233   if (this->is_connected_i () == 0)
00234     return; // TAO_THROW (RtecEventComm::Disconnected ());????
00235 
00236   if (this->suspended_ != 0)
00237     return;
00238 
00239   TAO_ESF_RefCount_Guard<CORBA::ULong> ace_mon (this->refcount_);
00240   // The guard will decrement the reference count, notice that the
00241   // reference count can become 0, but this is not the right spot to
00242   // check for that and destroy the object.
00243   // If we did so then we would destroy the object, and consequently
00244   // the mutex, but the mutex is used later when the stack unwinds and
00245   // the filter() method tries to destroy the mutex (that originally
00246   // acquired the mutex in the first place).
00247   // So the correct thing to do is to just decrement the reference
00248   // count and let the filter() method do the destruction.
00249 
00250   RtecEventComm::PushConsumer_var consumer =
00251     RtecEventComm::PushConsumer::_duplicate (this->consumer_.in ());
00252 
00253   this->pre_dispatch_hook (const_cast<RtecEventComm::EventSet&> (event));
00254 
00255   {
00256     // We have to release the lock to avoid dead-locks.
00257     TAO_EC_Unlock reverse_lock (*this->lock_);
00258 
00259     ACE_GUARD_THROW_EX (TAO_EC_Unlock, ace_mon, reverse_lock,
00260                         RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00261 
00262     this->event_channel_->dispatching ()->push (this,
00263                                                 consumer.in (),
00264                                                 event,
00265                                                 qos_info);
00266   }
00267 
00268   if (this->child_ != 0)
00269     this->child_->clear ();
00270 }

void TAO_EC_ProxyPushSupplier::push_nocopy ( RtecEventComm::EventSet event,
TAO_EC_QOS_Info qos_info 
) [virtual]

Implements TAO_EC_Filter.

Definition at line 278 of file EC_ProxySupplier.cpp.

References ACE_GUARD_THROW_EX, child_, TAO_EC_Filter::clear(), consumer(), TAO_EC_Event_Channel_Base::dispatching(), event_channel_, pre_dispatch_hook(), TAO_EC_Dispatching::push_nocopy(), and TAO_EC_Unlock.

00280 {
00281   // The mutex is already held by the caller (usually the filter()
00282   // method)
00283   if (this->is_connected_i () == 0)
00284     return; // TAO_THROW (RtecEventComm::Disconnected ());????
00285 
00286   if (this->suspended_ != 0)
00287     return;
00288 
00289   TAO_ESF_RefCount_Guard<CORBA::ULong> ace_mon (this->refcount_);
00290   // The guard will decrement the reference count, notice that the
00291   // reference count can become 0, but this is not the right spot to
00292   // check for that and destroy the object.
00293   // If we did so then we would destroy the object, and consequently
00294   // the mutex, but the mutex is used later when the stack unwinds and
00295   // the filter() method tries to destroy the mutex (that originally
00296   // acquired the mutex in the first place).
00297   // So the correct thing to do is to just decrement the reference
00298   // count and let the filter() method do the destruction.
00299 
00300   RtecEventComm::PushConsumer_var consumer =
00301     RtecEventComm::PushConsumer::_duplicate (this->consumer_.in ());
00302 
00303   this->pre_dispatch_hook (event);
00304 
00305   {
00306     TAO_EC_Unlock reverse_lock (*this->lock_);
00307 
00308     ACE_GUARD_THROW_EX (TAO_EC_Unlock, ace_mon, reverse_lock,
00309                         RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00310 
00311     this->event_channel_->dispatching ()->push_nocopy (this,
00312                                                        consumer.in (),
00313                                                        event,
00314                                                        qos_info);
00315   }
00316 
00317   if (this->child_ != 0)
00318     this->child_->clear ();
00319 }

void TAO_EC_ProxyPushSupplier::push_to_consumer ( RtecEventComm::PushConsumer_ptr  consumer,
const RtecEventComm::EventSet event 
)

These methods take consumer argument because during the time the filters have been processing the event, this proxy's consumer may have changed.

Definition at line 322 of file EC_ProxySupplier.cpp.

References ACE_GUARD_THROW_EX.

Referenced by TAO_EC_Kokyu_Push_Command::execute(), and TAO_EC_Push_Command::execute().

00325 {
00326   {
00327     ACE_GUARD_THROW_EX (
00328             ACE_Lock, ace_mon, *this->lock_,
00329             RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00330 
00331     if (this->is_connected_i () == 0)
00332       return; // ACE_THROW (RtecEventComm::Disconnected ());????
00333 
00334     if (this->suspended_ != 0)
00335       return;
00336   }
00337 
00338   try
00339     {
00340       consumer->push (event);
00341     }
00342   catch (const CORBA::OBJECT_NOT_EXIST&)
00343     {
00344       // Do not report errors for old consumers
00345       // NOTE: The comparison below is not completely correct, it
00346       // could be that the remote consumer and the local consumer are
00347       // in fact the same object, but represented by different objects
00348       // references.  Unfortunately this is not a good spot to invoke
00349       // _is_equivalent(), and that may not give us the desired answer
00350       // anyway.
00351       if (consumer == this->consumer_.in ())
00352         {
00353           TAO_EC_ConsumerControl *control =
00354             this->event_channel_->consumer_control ();
00355 
00356           control->consumer_not_exist (this);
00357         }
00358     }
00359   catch (CORBA::SystemException& sysex)
00360     {
00361       // Do not report errors for old consumers
00362       // NOTE: The comparison below is not completely correct, it
00363       // could be that the remote consumer and the local consumer are
00364       // in fact the same object, but represented by different objects
00365       // references.  Unfortunately this is not a good spot to invoke
00366       // _is_equivalent(), and that may not give us the desired answer
00367       // anyway.
00368       if (consumer == this->consumer_.in ())
00369         {
00370           TAO_EC_ConsumerControl *control =
00371             this->event_channel_->consumer_control ();
00372 
00373           control->system_exception (this,
00374                                      sysex);
00375         }
00376     }
00377   catch (const CORBA::Exception&)
00378     {
00379       // Shouldn't happen, but does not hurt
00380     }
00381 }

void TAO_EC_ProxyPushSupplier::reactive_push_to_consumer ( RtecEventComm::PushConsumer_ptr  consumer,
const RtecEventComm::EventSet event 
)

Definition at line 384 of file EC_ProxySupplier.cpp.

References TAO_EC_Event_Channel_Base::consumer_control(), TAO_EC_ConsumerControl::consumer_not_exist(), event_channel_, and TAO_EC_ConsumerControl::system_exception().

Referenced by TAO_EC_Reactive_Dispatching::push(), and TAO_EC_Reactive_Dispatching::push_nocopy().

00387 {
00388   try
00389     {
00390       consumer->push (event);
00391     }
00392   catch (const CORBA::OBJECT_NOT_EXIST&)
00393     {
00394       TAO_EC_ConsumerControl *control =
00395         this->event_channel_->consumer_control ();
00396 
00397       control->consumer_not_exist (this);
00398     }
00399   catch (CORBA::SystemException& sysex)
00400     {
00401       TAO_EC_ConsumerControl *control =
00402         this->event_channel_->consumer_control ();
00403 
00404       control->system_exception (this,
00405                                  sysex);
00406     }
00407   catch (const CORBA::Exception&)
00408     {
00409       // Shouldn't happen
00410     }
00411 }

void TAO_EC_ProxyPushSupplier::reconnected ( TAO_EC_ProxyPushSupplier supplier  )  [virtual]

Definition at line 79 of file EC_ProxySupplier.cpp.

00080 {
00081 }

void TAO_EC_ProxyPushSupplier::reconnected ( TAO_EC_ProxyPushConsumer consumer  )  [virtual]

Definition at line 59 of file EC_ProxySupplier.cpp.

References TAO_EC_Scheduling_Strategy::add_proxy_supplier_dependencies(), consumer(), event_channel_, and TAO_EC_Event_Channel_Base::scheduling_strategy().

00060 {
00061   TAO_EC_Scheduling_Strategy *s =
00062     this->event_channel_->scheduling_strategy ();
00063 
00064   s->add_proxy_supplier_dependencies (this,
00065                                       consumer);
00066 }

void TAO_EC_ProxyPushSupplier::refcount_zero_hook ( void   )  [private, virtual]

Template method hooks.

Definition at line 161 of file EC_ProxySupplier.cpp.

References TAO_EC_Event_Channel_Base::destroy_proxy(), and event_channel_.

Referenced by _decr_refcnt().

00162 {
00163   // Use the event channel
00164   this->event_channel_->destroy_proxy (this);
00165 }

ACE_INLINE void TAO_EC_ProxyPushSupplier::resume_connection_i ( void   )  [protected]

Definition at line 25 of file EC_ProxySupplier.inl.

References suspended_.

Referenced by resume_connection_locked().

00026 {
00027   this->suspended_ = 0;
00028 }

ACE_INLINE void TAO_EC_ProxyPushSupplier::resume_connection_locked ( void   )  [protected]

Definition at line 31 of file EC_ProxySupplier.inl.

References ACE_GUARD_THROW_EX, and resume_connection_i().

Referenced by TAO_EC_Default_ProxyPushSupplier::resume_connection().

00032 {
00033   ACE_GUARD_THROW_EX (
00034             ACE_Lock, ace_mon, *this->lock_,
00035             CORBA::INTERNAL ());
00036   // @@ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00037 
00038   this->resume_connection_i ();
00039 }

void TAO_EC_ProxyPushSupplier::shutdown ( void   )  [virtual]

The event channel is shutting down.

Definition at line 89 of file EC_ProxySupplier.cpp.

References ACE_GUARD_THROW_EX, cleanup_i(), connected(), consumer(), consumer_, deactivate(), is_connected_i(), and CORBA::is_nil().

00090 {
00091   // Save the consumer we where connected to, we need to send a
00092   // disconnect message to it.
00093   RtecEventComm::PushConsumer_var consumer;
00094 
00095   {
00096     ACE_GUARD_THROW_EX (
00097         ACE_Lock, ace_mon, *this->lock_,
00098         RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00099 
00100     int connected = this->is_connected_i ();
00101 
00102     consumer = this->consumer_._retn ();
00103 
00104     if (connected)
00105       this->cleanup_i ();
00106   }
00107 
00108   this->deactivate ();
00109 
00110   if (CORBA::is_nil (consumer.in ()))
00111     return;
00112 
00113   try
00114     {
00115       consumer->disconnect_push_consumer ();
00116     }
00117   catch (const CORBA::Exception&)
00118     {
00119       // Ignore exceptions, we must isolate other clients from
00120       // problems on this one.
00121     }
00122 }

ACE_INLINE const RtecEventChannelAdmin::ConsumerQOS & TAO_EC_ProxyPushSupplier::subscriptions ( void   )  const

The QoS (subscription) used to connect to the EC.

Definition at line 85 of file EC_ProxySupplier.inl.

References ACE_GUARD_RETURN, and qos_.

Referenced by TAO_EC_Reactive_ObserverStrategy::consumer_qos_update(), TAO_EC_Basic_ObserverStrategy::consumer_qos_update(), and TAO_EC_Accumulate_Supplier_Headers::work().

00086 {
00087   // @@ TODO There should be a better way to signal errors here.
00088   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, this->qos_);
00089 
00090   return this->qos_;
00091 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE void TAO_EC_ProxyPushSupplier::suspend_connection_i ( void   )  [protected]

Definition at line 8 of file EC_ProxySupplier.inl.

References suspended_.

Referenced by suspend_connection_locked().

00009 {
00010   this->suspended_ = 1;
00011 }

ACE_INLINE void TAO_EC_ProxyPushSupplier::suspend_connection_locked ( void   )  [protected]

Definition at line 14 of file EC_ProxySupplier.inl.

References ACE_GUARD_THROW_EX, and suspend_connection_i().

Referenced by TAO_EC_Default_ProxyPushSupplier::suspend_connection().

00015 {
00016   ACE_GUARD_THROW_EX (
00017             ACE_Lock, ace_mon, *this->lock_,
00018             CORBA::INTERNAL ());
00019   // @@ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00020 
00021   this->suspend_connection_i ();
00022 }


Member Data Documentation

TAO_EC_Filter* TAO_EC_ProxyPushSupplier::child_ [protected]

The filter object.

Definition at line 186 of file EC_ProxySupplier.h.

Referenced by add_dependencies(), can_match(), cleanup_i(), clear(), TAO_EC_Default_ProxyPushSupplier::connect_push_consumer(), filter(), filter_nocopy(), max_event_size(), push(), and push_nocopy().

RtecEventComm::PushConsumer_var TAO_EC_ProxyPushSupplier::consumer_ [protected]

The consumer....

Definition at line 174 of file EC_ProxySupplier.h.

Referenced by cleanup_i(), TAO_EC_Default_ProxyPushSupplier::connect_push_consumer(), consumer_i(), TAO_EC_Default_ProxyPushSupplier::disconnect_push_supplier(), and shutdown().

int TAO_EC_ProxyPushSupplier::consumer_validate_connection_ [protected]

Validate the connection to consumer on connect.

Definition at line 189 of file EC_ProxySupplier.h.

Referenced by TAO_EC_Default_ProxyPushSupplier::connect_push_consumer().

PortableServer::POA_var TAO_EC_ProxyPushSupplier::default_POA_ [protected]

Store the default POA.

Definition at line 183 of file EC_ProxySupplier.h.

Referenced by deactivate(), and TAO_EC_Default_ProxyPushSupplier::object_id().

TAO_EC_Event_Channel_Base* TAO_EC_ProxyPushSupplier::event_channel_ [protected]

The Event Channel that owns this object.

Definition at line 165 of file EC_ProxySupplier.h.

Referenced by TAO_EC_Default_ProxyPushSupplier::connect_push_consumer(), connected(), TAO_EC_Default_ProxyPushSupplier::disconnect_push_supplier(), push(), push_nocopy(), reactive_push_to_consumer(), reconnected(), refcount_zero_hook(), TAO_EC_TPC_ProxyPushSupplier::tpc_dispatching(), and ~TAO_EC_ProxyPushSupplier().

ACE_Lock* TAO_EC_ProxyPushSupplier::lock_ [protected]

The locking strategy.

Definition at line 168 of file EC_ProxySupplier.h.

RtecEventChannelAdmin::ConsumerQOS TAO_EC_ProxyPushSupplier::qos_ [protected]

The subscription and QoS information...

Definition at line 180 of file EC_ProxySupplier.h.

Referenced by TAO_EC_Default_ProxyPushSupplier::connect_push_consumer(), and subscriptions().

CORBA::ULong TAO_EC_ProxyPushSupplier::refcount_ [protected]

The reference count.

Definition at line 171 of file EC_ProxySupplier.h.

Referenced by _decr_refcnt(), and _incr_refcnt().

CORBA::Boolean TAO_EC_ProxyPushSupplier::suspended_ [protected]

Is this consumer suspended?

Definition at line 177 of file EC_ProxySupplier.h.

Referenced by is_suspended(), resume_connection_i(), and suspend_connection_i().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:44:33 2010 for TAO_RTEvent by  doxygen 1.4.7