TAO_EC_Default_ProxyPushSupplier Class Reference

Implement the ReliableEventChannelAdmin::ProxyPushSupplier interface. More...

#include <EC_Default_ProxySupplier.h>

Inheritance diagram for TAO_EC_Default_ProxyPushSupplier:

Inheritance graph
[legend]
Collaboration diagram for TAO_EC_Default_ProxyPushSupplier:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_EC_Default_ProxyPushSupplier (TAO_EC_Event_Channel_Base *event_channel, int validate_connection)
 Constructor...
virtual ~TAO_EC_Default_ProxyPushSupplier (void)
 Destructor...
void activate (RtecEventChannelAdmin::ProxyPushSupplier_ptr &proxy)
 Activate in the POA.
virtual void connect_push_consumer (RtecEventComm::PushConsumer_ptr push_consumer, const RtecEventChannelAdmin::ConsumerQOS &qos)
 IDL methods.
virtual void disconnect_push_supplier (void)
 Disconnect this from.
virtual void suspend_connection (void)
virtual void resume_connection (void)
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

Implement the ReliableEventChannelAdmin::ProxyPushSupplier interface.

Definition at line 34 of file EC_Default_ProxySupplier.h.


Constructor & Destructor Documentation

TAO_EC_Default_ProxyPushSupplier::TAO_EC_Default_ProxyPushSupplier ( TAO_EC_Event_Channel_Base event_channel,
int  validate_connection 
)

Constructor...

Definition at line 17 of file EC_Default_ProxySupplier.cpp.

00020   : TAO_EC_ProxyPushSupplier (ec, validate_connection)
00021 {
00022 }

TAO_EC_Default_ProxyPushSupplier::~TAO_EC_Default_ProxyPushSupplier ( void   )  [virtual]

Destructor...

Definition at line 24 of file EC_Default_ProxySupplier.cpp.

00025 {
00026 }


Member Function Documentation

void TAO_EC_Default_ProxyPushSupplier::_add_ref ( void   )  [virtual]

Definition at line 173 of file EC_Default_ProxySupplier.cpp.

References TAO_EC_ProxyPushSupplier::_incr_refcnt().

00174 {
00175   this->_incr_refcnt ();
00176 }

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

Definition at line 167 of file EC_Default_ProxySupplier.cpp.

00168 {
00169   return PortableServer::POA::_duplicate (this->default_POA_.in ());
00170 }

void TAO_EC_Default_ProxyPushSupplier::_remove_ref ( void   )  [virtual]

Definition at line 179 of file EC_Default_ProxySupplier.cpp.

References TAO_EC_ProxyPushSupplier::_decr_refcnt().

00180 {
00181   this->_decr_refcnt ();
00182 }

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

Activate in the POA.

Implements TAO_EC_ProxyPushSupplier.

Definition at line 185 of file EC_Default_ProxySupplier.cpp.

00187 {
00188   proxy = this->_this ();
00189 }

void TAO_EC_Default_ProxyPushSupplier::connect_push_consumer ( RtecEventComm::PushConsumer_ptr  push_consumer,
const RtecEventChannelAdmin::ConsumerQOS qos 
) [virtual]

IDL methods.

Reimplemented in TAO_EC_TPC_ProxyPushSupplier.

Definition at line 29 of file EC_Default_ProxySupplier.cpp.

References ACE_DEBUG, ACE_GUARD_THROW_EX, TAO_EC_Filter::adopt_child(), TAO_EC_Filter_Builder::build(), TAO_EC_ProxyPushSupplier::child_, TAO_EC_ProxyPushSupplier::cleanup_i(), TAO_EC_Event_Channel_Base::connected(), TAO_EC_ProxyPushSupplier::consumer_, TAO_EC_ProxyPushSupplier::consumer_validate_connection_, TAO_EC_ProxyPushSupplier::event_channel_, TAO_EC_Event_Channel_Base::filter_builder(), CORBA::is_nil(), LM_DEBUG, TAO_EC_ProxyPushSupplier::qos_, TAO_EC_Event_Channel_Base::reconnected(), and TAO_EC_Unlock.

Referenced by TAO_EC_TPC_ProxyPushSupplier::connect_push_consumer().

00032 {
00033   // Nil PushConsumers are illegal
00034   if (CORBA::is_nil (push_consumer))
00035     throw CORBA::BAD_PARAM ();
00036 
00037   {
00038     ACE_GUARD_THROW_EX (
00039         ACE_Lock, ace_mon, *this->lock_,
00040         CORBA::INTERNAL ());
00041     // @@ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00042 
00043     if (this->is_connected_i ())
00044       {
00045         if (this->event_channel_->consumer_reconnect () == 0)
00046           throw RtecEventChannelAdmin::AlreadyConnected ();
00047 
00048         // Re-connections are allowed....
00049         this->cleanup_i ();
00050 
00051         this->consumer_ =
00052           RtecEventComm::PushConsumer::_duplicate (push_consumer);
00053         this->qos_ = qos;
00054         this->child_ =
00055           this->event_channel_->filter_builder ()->build (this,
00056                                                           this->qos_);
00057 
00058         this->adopt_child (this->child_);
00059 
00060         TAO_EC_Unlock reverse_lock (*this->lock_);
00061 
00062         {
00063           ACE_GUARD_THROW_EX (
00064               TAO_EC_Unlock, ace_mon, reverse_lock,
00065               CORBA::INTERNAL ());
00066           // @@ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00067 
00068           this->event_channel_->reconnected (this);
00069         }
00070 
00071         // A separate thread could have connected simultaneously,
00072         // this is probably an application error, handle it as
00073         // gracefully as possible
00074         if (this->is_connected_i ())
00075           return; // @@ Should we throw
00076       }
00077 
00078 #if (TAO_HAS_CORBA_MESSAGING == 1)
00079       if ( consumer_validate_connection_ == 1 )
00080       {
00081         // Validate connection during connect.
00082         CORBA::PolicyList_var unused;
00083         int status = push_consumer->_validate_connection (unused);
00084 #if TAO_EC_ENABLE_DEBUG_MESSAGES
00085         ACE_DEBUG ((LM_DEBUG, "Validated connection to PushConsumer on connect. Status[%d]\n", status));
00086 #else
00087         ACE_UNUSED_ARG(status);
00088 #endif /* TAO_EC_ENABLED_DEBUG_MESSAGES */
00089       }
00090 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
00091 
00092       this->consumer_ =
00093         RtecEventComm::PushConsumer::_duplicate (push_consumer);
00094       this->qos_ = qos;
00095 
00096 #if TAO_EC_ENABLE_DEBUG_MESSAGES
00097     ACE_DEBUG ((LM_DEBUG,
00098                 "Building filters for consumer <%x>.\n",
00099                 this));
00100 #endif /* TAO_EC_ENABLED_DEBUG_MESSAGES */
00101     this->child_ =
00102       this->event_channel_->filter_builder ()->build (this,
00103                                                       this->qos_);
00104 
00105     this->adopt_child (this->child_);
00106   }
00107 
00108   // Notify the event channel...
00109   this->event_channel_->connected (this);
00110 }

void TAO_EC_Default_ProxyPushSupplier::disconnect_push_supplier ( void   )  [virtual]

Disconnect this from.

Implements TAO_EC_ProxyPushSupplier.

Reimplemented in TAO_EC_TPC_ProxyPushSupplier.

Definition at line 113 of file EC_Default_ProxySupplier.cpp.

References CORBA::Exception::_tao_print_exception(), ACE_GUARD_THROW_EX, TAO_EC_ProxyPushSupplier::cleanup_i(), TAO_EC_ProxyPushSupplier::connected(), TAO_EC_ProxyPushSupplier::consumer(), TAO_EC_ProxyPushSupplier::consumer_, TAO_EC_Event_Channel_Base::disconnected(), TAO_EC_ProxyPushSupplier::event_channel_, and TAO_EC_ProxyPushSupplier::is_connected_i().

Referenced by TAO_EC_TPC_ProxyPushSupplier::disconnect_push_supplier().

00114 {
00115   RtecEventComm::PushConsumer_var consumer;
00116   int connected = 0;
00117 
00118   {
00119     ACE_GUARD_THROW_EX (
00120         ACE_Lock, ace_mon, *this->lock_,
00121         CORBA::INTERNAL ());
00122     // @@ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00123 
00124     connected = this->is_connected_i ();
00125     consumer = this->consumer_._retn ();
00126 
00127     if (connected)
00128       this->cleanup_i ();
00129   }
00130 
00131   // Notify the event channel....
00132   this->event_channel_->disconnected (this);
00133 
00134   if (!connected)
00135     {
00136       return;
00137     }
00138 
00139   if (this->event_channel_->disconnect_callbacks ())
00140     {
00141       try
00142         {
00143           consumer->disconnect_push_consumer ();
00144         }
00145       catch (const CORBA::Exception& ex)
00146         {
00147           // Ignore exceptions, we must isolate other clients from
00148           // problems on this one.
00149           ex._tao_print_exception ("ProxySupplier::disconnect_push_supplier");
00150         }
00151     }
00152 }

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

Implements TAO_EC_ProxyPushSupplier.

Definition at line 192 of file EC_Default_ProxySupplier.cpp.

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

00193 {
00194   PortableServer::ObjectId_var result =
00195     this->default_POA_->servant_to_id (this);
00196 
00197   return result.in ();
00198 }

void TAO_EC_Default_ProxyPushSupplier::resume_connection ( void   )  [virtual]

Definition at line 161 of file EC_Default_ProxySupplier.cpp.

References TAO_EC_ProxyPushSupplier::resume_connection_locked().

00162 {
00163   this->resume_connection_locked ();
00164 }

void TAO_EC_Default_ProxyPushSupplier::suspend_connection ( void   )  [virtual]

Definition at line 155 of file EC_Default_ProxySupplier.cpp.

References TAO_EC_ProxyPushSupplier::suspend_connection_locked().

00156 {
00157   this->suspend_connection_locked ();
00158 }


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