TAO_EC_Default_ProxyPushConsumer Class Reference

implements RtecEventChannelAdmin::ProxyPushConsumer interface. More...

#include <EC_Default_ProxyConsumer.h>

Inheritance diagram for TAO_EC_Default_ProxyPushConsumer:

Inheritance graph
[legend]
Collaboration diagram for TAO_EC_Default_ProxyPushConsumer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_EC_Default_ProxyPushConsumer (TAO_EC_Event_Channel_Base *event_channel)
 Constructor...
virtual ~TAO_EC_Default_ProxyPushConsumer (void)
 Destructor...
virtual void activate (RtecEventChannelAdmin::ProxyPushConsumer_ptr &proxy)
 Activate in the POA.
virtual void connect_push_supplier (RtecEventComm::PushSupplier_ptr push_supplier, const RtecEventChannelAdmin::SupplierQOS &qos)
virtual void push (const RtecEventComm::EventSet &event)
virtual void disconnect_push_consumer (void)
 Disconnect this from.
virtual PortableServer::POA_ptr _default_POA (void)
virtual void _add_ref (void)
virtual void _remove_ref (void)

Private Member Functions

virtual PortableServer::ObjectId object_id (void)

Detailed Description

implements RtecEventChannelAdmin::ProxyPushConsumer interface.

Definition at line 39 of file EC_Default_ProxyConsumer.h.


Constructor & Destructor Documentation

TAO_EC_Default_ProxyPushConsumer::TAO_EC_Default_ProxyPushConsumer ( TAO_EC_Event_Channel_Base event_channel  ) 

Constructor...

Definition at line 16 of file EC_Default_ProxyConsumer.cpp.

00017   : TAO_EC_ProxyPushConsumer (ec)
00018 {
00019 }

TAO_EC_Default_ProxyPushConsumer::~TAO_EC_Default_ProxyPushConsumer ( void   )  [virtual]

Destructor...

Definition at line 21 of file EC_Default_ProxyConsumer.cpp.

00022 {
00023 }


Member Function Documentation

void TAO_EC_Default_ProxyPushConsumer::_add_ref ( void   )  [virtual]

Definition at line 146 of file EC_Default_ProxyConsumer.cpp.

References TAO_EC_ProxyPushConsumer::_incr_refcnt().

00147 {
00148   this->_incr_refcnt ();
00149 }

PortableServer::POA_ptr TAO_EC_Default_ProxyPushConsumer::_default_POA ( void   )  [virtual]

Definition at line 140 of file EC_Default_ProxyConsumer.cpp.

00141 {
00142   return PortableServer::POA::_duplicate (this->default_POA_.in ());
00143 }

void TAO_EC_Default_ProxyPushConsumer::_remove_ref ( void   )  [virtual]

Definition at line 152 of file EC_Default_ProxyConsumer.cpp.

References TAO_EC_ProxyPushConsumer::_decr_refcnt().

00153 {
00154   this->_decr_refcnt ();
00155 }

void TAO_EC_Default_ProxyPushConsumer::activate ( RtecEventChannelAdmin::ProxyPushConsumer_ptr &  proxy  )  [virtual]

Activate in the POA.

Implements TAO_EC_ProxyPushConsumer.

Definition at line 158 of file EC_Default_ProxyConsumer.cpp.

00160 {
00161   proxy = this->_this ();
00162 }

void TAO_EC_Default_ProxyPushConsumer::connect_push_supplier ( RtecEventComm::PushSupplier_ptr  push_supplier,
const RtecEventChannelAdmin::SupplierQOS qos 
) [virtual]

Definition at line 26 of file EC_Default_ProxyConsumer.cpp.

References ACE_DEBUG, ACE_GUARD_THROW_EX, TAO_EC_Supplier_Filter::bind(), TAO_EC_ProxyPushConsumer::cleanup_i(), TAO_EC_Event_Channel_Base::connected(), TAO_EC_ProxyPushConsumer::connected_, TAO_EC_Supplier_Filter_Builder::create(), TAO_EC_ProxyPushConsumer::event_channel_, TAO_EC_ProxyPushConsumer::filter_, LM_DEBUG, TAO_EC_ProxyPushConsumer::qos_, TAO_EC_Event_Channel_Base::reconnected(), TAO_EC_ProxyPushConsumer::supplier_, TAO_EC_Event_Channel_Base::supplier_filter_builder(), and TAO_EC_Unlock.

00029 {
00030   {
00031     ACE_GUARD_THROW_EX (
00032         ACE_Lock, ace_mon, *this->lock_,
00033         CORBA::INTERNAL ());
00034     // @@ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00035 
00036     if (this->is_connected_i ())
00037       {
00038         if (this->event_channel_->supplier_reconnect () == 0)
00039           throw RtecEventChannelAdmin::AlreadyConnected ();
00040 
00041         // Re-connections are allowed, go ahead and disconnect the
00042         // consumer...
00043         this->cleanup_i ();
00044 
00045         // @@ Please read the comments in EC_ProxySuppliers about
00046         //     possible race conditions in this area...
00047         TAO_EC_Unlock reverse_lock (*this->lock_);
00048 
00049         {
00050           ACE_GUARD_THROW_EX (
00051               TAO_EC_Unlock, ace_mon, reverse_lock,
00052               CORBA::INTERNAL ());
00053           // @@ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00054 
00055           this->event_channel_->reconnected (this);
00056         }
00057 
00058         // A separate thread could have connected siomultaneously,
00059         // this is probably an application error, handle it as
00060         // gracefully as possible
00061         if (this->is_connected_i ())
00062           return; // @@ Should we throw
00063       }
00064 
00065     this->supplier_ =
00066       RtecEventComm::PushSupplier::_duplicate (push_supplier);
00067     this->connected_ = 1;
00068     this->qos_ = qos;
00069 
00070 #if TAO_EC_ENABLE_DEBUG_MESSAGES
00071     ACE_DEBUG ((LM_DEBUG,
00072                  "Building filter for supplier <%x>.\n",
00073                 this));
00074 #endif /* TAO_EC_ENABLED_DEBUG_MESSAGES */
00075     this->filter_ =
00076       this->event_channel_->supplier_filter_builder ()->create (this->qos_);
00077     this->filter_->bind (this);
00078   }
00079 
00080   // Notify the event channel...
00081   this->event_channel_->connected (this);
00082 }

void TAO_EC_Default_ProxyPushConsumer::disconnect_push_consumer ( void   )  [virtual]

Disconnect this from.

Implements TAO_EC_ProxyPushConsumer.

Reimplemented in TAO_EC_TPC_ProxyPushConsumer.

Definition at line 98 of file EC_Default_ProxyConsumer.cpp.

References ACE_GUARD_THROW_EX, TAO_EC_ProxyPushConsumer::cleanup_i(), TAO_EC_ProxyPushConsumer::connected(), TAO_EC_ProxyPushConsumer::connected_, TAO_EC_Event_Channel_Base::disconnected(), TAO_EC_ProxyPushConsumer::event_channel_, TAO_EC_ProxyPushConsumer::is_connected_i(), CORBA::is_nil(), TAO_EC_ProxyPushConsumer::supplier(), and TAO_EC_ProxyPushConsumer::supplier_.

Referenced by TAO_EC_TPC_ProxyPushConsumer::disconnect_push_consumer().

00099 {
00100   RtecEventComm::PushSupplier_var supplier;
00101   int connected = 0;
00102 
00103   {
00104     ACE_GUARD_THROW_EX (
00105         ACE_Lock, ace_mon, *this->lock_,
00106         CORBA::INTERNAL ());
00107     // @@ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00108 
00109     connected = this->is_connected_i ();
00110     supplier = this->supplier_._retn ();
00111     this->connected_ = 0;
00112 
00113     if (connected)
00114       this->cleanup_i ();
00115   }
00116 
00117   // Notify the event channel...
00118   this->event_channel_->disconnected (this);
00119 
00120   if (CORBA::is_nil (supplier.in ()))
00121     {
00122       return;
00123     }
00124 
00125   if (this->event_channel_->disconnect_callbacks ())
00126     {
00127       try
00128         {
00129           supplier->disconnect_push_supplier ();
00130         }
00131       catch (const CORBA::Exception&)
00132         {
00133           // Ignore exceptions, we must isolate other clients from
00134           // failures on this one.
00135         }
00136     }
00137 }

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

Implements TAO_EC_ProxyPushConsumer.

Definition at line 165 of file EC_Default_ProxyConsumer.cpp.

References TAO_EC_ProxyPushConsumer::default_POA_, and TAO_Objref_Var_T< T >::in().

00166 {
00167   PortableServer::ObjectId_var result =
00168     this->default_POA_->servant_to_id (this);
00169   return result.in ();
00170 }

void TAO_EC_Default_ProxyPushConsumer::push ( const RtecEventComm::EventSet event  )  [virtual]

Definition at line 85 of file EC_Default_ProxyConsumer.cpp.

References TAO_EC_ProxyPushConsumer_Guard::filter, TAO_EC_ProxyPushConsumer_Guard::locked(), and TAO_EC_Supplier_Filter::push().

00086 {
00087   TAO_EC_ProxyPushConsumer_Guard ace_mon (this->lock_,
00088                                           this->refcount_,
00089                                           this->event_channel_,
00090                                           this);
00091   if (!ace_mon.locked ())
00092     return;
00093 
00094   ace_mon.filter->push (event, this);
00095 }


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