TAO_EC_ProxyPushConsumer Class Reference

ProxyPushConsumer. More...

#include <EC_ProxyConsumer.h>

Inheritance diagram for TAO_EC_ProxyPushConsumer:

Inheritance graph
[legend]
Collaboration diagram for TAO_EC_ProxyPushConsumer:

Collaboration graph
[legend]
List of all members.

Public Types

typedef RtecEventChannelAdmin::ProxyPushConsumer Interface
typedef RtecEventChannelAdmin::ProxyPushConsumer_var _var_type
typedef RtecEventChannelAdmin::ProxyPushConsumer_ptr _ptr_type

Public Member Functions

 TAO_EC_ProxyPushConsumer (TAO_EC_Event_Channel_Base *event_channel)
 constructor...

virtual ~TAO_EC_ProxyPushConsumer (void)
 destructor...

virtual void activate (RtecEventChannelAdmin::ProxyPushConsumer_ptr &proxy)=0
 Activate in the POA.

virtual void deactivate (void)
 Deactivate from the POA.

virtual void disconnect_push_consumer ()=0
 Disconnect this from.

CORBA::Boolean is_connected (void) const
 Return 0 if no supplier is connected...

RtecEventComm::PushSupplier_ptr supplier (void) const
const RtecEventChannelAdmin::SupplierQOSpublications (void) const
 The QoS (subscription) used to connect to the EC.

CORBA::Boolean supplier_non_existent (CORBA::Boolean_out disconnected)
virtual void connected (TAO_EC_ProxyPushSupplier *supplier)
virtual void reconnected (TAO_EC_ProxyPushSupplier *supplier)
virtual void disconnected (TAO_EC_ProxyPushSupplier *supplier)
virtual void connected (TAO_EC_ProxyPushConsumer *consumer)
virtual void reconnected (TAO_EC_ProxyPushConsumer *consumer)
virtual void disconnected (TAO_EC_ProxyPushConsumer *consumer)
virtual void shutdown (void)
 The event channel is shutting down.

const RtecEventChannelAdmin::SupplierQOSpublications_i (void) const
CORBA::ULong _incr_refcnt (void)
 Increment and decrement the reference count.

CORBA::ULong _decr_refcnt (void)

Protected Member Functions

void supplier (RtecEventComm::PushSupplier_ptr supplier)
void supplier_i (RtecEventComm::PushSupplier_ptr supplier)
CORBA::Boolean is_connected_i (void) const
 The private version (without locking) of is_connected().

TAO_EC_Supplier_Filterfilter_i (void) const
 Return the current filter, assumes the locks are held.

void cleanup_i (void)
 Release the filter and the supplier.


Protected Attributes

TAO_EC_Event_Channel_Baseevent_channel_
 The supplier admin, used for activation and memory managment.

ACE_Locklock_
 The locking strategy.

CORBA::ULong refcount_
 The reference count.

RtecEventComm::PushSupplier_var supplier_
 The supplier....

int connected_
RtecEventChannelAdmin::SupplierQOS qos_
 The publication and QoS information...

PortableServer::POA_var default_POA_
 Store the default POA.

TAO_EC_Supplier_Filterfilter_
 The strategy to do filtering close to the supplier.


Private Member Functions

virtual void shutdown_hook (void)
 Template method hooks.

virtual void refcount_zero_hook (void)
virtual PortableServer::ObjectId object_id (void)=0

Friends

class TAO_EC_ProxyPushConsumer_Guard

Detailed Description

ProxyPushConsumer.

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

Memory Management

It makes a copy of the SupplierQOS and the supplier object reference. It uses bind/unbind to control the lifetime of the Supplier_Filter object. The object commits suicide when disconnect_push_consumer() is called.

Locking

No provisions for locking, access must be serialized externally.

Definition at line 56 of file EC_ProxyConsumer.h.


Member Typedef Documentation

typedef RtecEventChannelAdmin::ProxyPushConsumer_ptr TAO_EC_ProxyPushConsumer::_ptr_type
 

Definition at line 61 of file EC_ProxyConsumer.h.

typedef RtecEventChannelAdmin::ProxyPushConsumer_var TAO_EC_ProxyPushConsumer::_var_type
 

Definition at line 60 of file EC_ProxyConsumer.h.

typedef RtecEventChannelAdmin::ProxyPushConsumer TAO_EC_ProxyPushConsumer::Interface
 

Definition at line 59 of file EC_ProxyConsumer.h.


Constructor & Destructor Documentation

TAO_EC_ProxyPushConsumer::TAO_EC_ProxyPushConsumer TAO_EC_Event_Channel_Base event_channel  ) 
 

constructor...

Definition at line 23 of file EC_ProxyConsumer.cpp.

References TAO_EC_Event_Channel_Base::consumer_poa(), TAO_EC_Event_Channel_Base::create_consumer_lock(), and RtecEventChannelAdmin::SupplierQOS::is_gateway.

00024   : event_channel_ (ec),
00025     refcount_ (1),
00026     connected_ (0),
00027     filter_ (0)
00028 {
00029   this->lock_ =
00030     this->event_channel_->create_consumer_lock ();
00031 
00032   this->default_POA_ =
00033     this->event_channel_->consumer_poa ();
00034 
00035   this->qos_.is_gateway = 0;
00036 }

TAO_EC_ProxyPushConsumer::~TAO_EC_ProxyPushConsumer void   )  [virtual]
 

destructor...

Definition at line 38 of file EC_ProxyConsumer.cpp.

References cleanup_i(), and TAO_EC_Event_Channel_Base::destroy_consumer_lock().

00039 {
00040   this->event_channel_->destroy_consumer_lock (this->lock_);
00041   this->cleanup_i ();
00042 }


Member Function Documentation

CORBA::ULong TAO_EC_ProxyPushConsumer::_decr_refcnt void   ) 
 

Definition at line 221 of file EC_ProxyConsumer.cpp.

References ACE_GUARD_RETURN, and refcount_zero_hook().

Referenced by TAO_EC_Default_ProxyPushConsumer::_remove_ref().

00222 {
00223   {
00224     ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00225     this->refcount_--;
00226     if (this->refcount_ != 0)
00227       return this->refcount_;
00228   }
00229 
00230   this->refcount_zero_hook ();
00231   return 0;
00232 }

CORBA::ULong TAO_EC_ProxyPushConsumer::_incr_refcnt void   ) 
 

Increment and decrement the reference count.

Definition at line 207 of file EC_ProxyConsumer.cpp.

References ACE_GUARD_RETURN.

Referenced by TAO_EC_Default_ProxyPushConsumer::_add_ref().

00208 {
00209   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00210   return this->refcount_++;
00211 }

virtual void TAO_EC_ProxyPushConsumer::activate RtecEventChannelAdmin::ProxyPushConsumer_ptr &  proxy  )  [pure virtual]
 

Activate in the POA.

Implemented in TAO_EC_Default_ProxyPushConsumer.

void TAO_EC_ProxyPushConsumer::cleanup_i void   )  [protected]
 

Release the filter and the supplier.

Definition at line 174 of file EC_ProxyConsumer.cpp.

References TAO_EC_Supplier_Filter::_decr_refcnt(), connected_, filter_, and TAO_EC_Supplier_Filter::unbind().

Referenced by TAO_EC_Default_ProxyPushConsumer::connect_push_supplier(), TAO_EC_Default_ProxyPushConsumer::disconnect_push_consumer(), shutdown(), and ~TAO_EC_ProxyPushConsumer().

00175 {
00176   this->supplier_ =
00177     RtecEventComm::PushSupplier::_nil ();
00178   this->connected_ = 0;
00179 
00180   if (this->filter_ != 0)
00181     {
00182       this->filter_->unbind (this);
00183       this->filter_->_decr_refcnt ();
00184       this->filter_ = 0;
00185     }
00186 }

void TAO_EC_ProxyPushConsumer::connected TAO_EC_ProxyPushConsumer consumer  )  [virtual]
 

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

Definition at line 115 of file EC_ProxyConsumer.cpp.

00116 {
00117 }

void TAO_EC_ProxyPushConsumer::connected TAO_EC_ProxyPushSupplier supplier  )  [virtual]
 

Concrete implementations can use this methods to keep track of the consumers interested in this events.

Definition at line 76 of file EC_ProxyConsumer.cpp.

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

00077 {
00078   TAO_EC_ProxyPushConsumer_Guard ace_mon (this->lock_,
00079                                           this->refcount_,
00080                                           this->event_channel_,
00081                                           this);
00082   if (!ace_mon.locked ())
00083     return;
00084 
00085   ace_mon.filter->connected (supplier);
00086 }

void TAO_EC_ProxyPushConsumer::deactivate void   )  [virtual]
 

Deactivate from the POA.

Definition at line 189 of file EC_ProxyConsumer.cpp.

References object_id().

Referenced by shutdown().

00190 {
00191   try
00192     {
00193       PortableServer::ObjectId id =
00194           this->object_id ();
00195       this->default_POA_->deactivate_object (id);
00196     }
00197   catch (const CORBA::Exception&)
00198     {
00199       // Exceptions here should not be propagated.  They usually
00200       // indicate that an object is beign disconnected twice, or some
00201       // race condition, but not a fault that the user needs to know
00202       // about.
00203     }
00204 }

virtual void TAO_EC_ProxyPushConsumer::disconnect_push_consumer  )  [pure virtual]
 

Disconnect this from.

Implemented in TAO_EC_Default_ProxyPushConsumer, and TAO_EC_TPC_ProxyPushConsumer.

Referenced by TAO_EC_Reactive_SupplierControl::supplier_not_exist(), and TAO_EC_Reactive_SupplierControl::system_exception().

void TAO_EC_ProxyPushConsumer::disconnected TAO_EC_ProxyPushConsumer consumer  )  [virtual]
 

Definition at line 125 of file EC_ProxyConsumer.cpp.

00126 {
00127 }

void TAO_EC_ProxyPushConsumer::disconnected TAO_EC_ProxyPushSupplier supplier  )  [virtual]
 

Definition at line 102 of file EC_ProxyConsumer.cpp.

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

00103 {
00104   TAO_EC_ProxyPushConsumer_Guard ace_mon (this->lock_,
00105                                           this->refcount_,
00106                                           this->event_channel_,
00107                                           this);
00108   if (!ace_mon.locked ())
00109     return;
00110 
00111   ace_mon.filter->disconnected (supplier);
00112 }

ACE_INLINE TAO_EC_Supplier_Filter * TAO_EC_ProxyPushConsumer::filter_i void   )  const [protected]
 

Return the current filter, assumes the locks are held.

Definition at line 58 of file EC_ProxyConsumer.inl.

References filter_.

Referenced by TAO_EC_ProxyPushConsumer_Guard::TAO_EC_ProxyPushConsumer_Guard().

00059 {
00060   return this->filter_;
00061 }

ACE_INLINE CORBA::Boolean TAO_EC_ProxyPushConsumer::is_connected void   )  const
 

Return 0 if no supplier is connected...

Definition at line 14 of file EC_ProxyConsumer.inl.

References ACE_GUARD_RETURN, and is_connected_i().

00015 {
00016   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00017 
00018   return this->is_connected_i ();
00019 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE CORBA::Boolean TAO_EC_ProxyPushConsumer::is_connected_i void   )  const [protected]
 

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

Definition at line 8 of file EC_ProxyConsumer.inl.

References connected_.

Referenced by TAO_EC_Default_ProxyPushConsumer::connect_push_supplier(), TAO_EC_Default_ProxyPushConsumer::disconnect_push_consumer(), is_connected(), supplier_non_existent(), and TAO_EC_ProxyPushConsumer_Guard::TAO_EC_ProxyPushConsumer_Guard().

00009 {
00010   return this->connected_;
00011 }

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

Implemented in TAO_EC_Default_ProxyPushConsumer.

Referenced by deactivate().

ACE_INLINE const RtecEventChannelAdmin::SupplierQOS & TAO_EC_ProxyPushConsumer::publications void   )  const
 

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

Definition at line 43 of file EC_ProxyConsumer.inl.

References ACE_GUARD_RETURN.

Referenced by TAO_EC_Priority_Scheduling::add_proxy_supplier_dependencies(), TAO_EC_Kokyu_Scheduling::add_proxy_supplier_dependencies(), TAO_EC_Priority_Scheduling::schedule_event(), TAO_EC_Kokyu_Scheduling::schedule_event(), TAO_EC_Reactive_ObserverStrategy::supplier_qos_update(), TAO_EC_Basic_ObserverStrategy::supplier_qos_update(), and TAO_EC_Accumulate_Consumer_Headers::work().

00044 {
00045   // @@ TODO There should some way to signal errors here.
00046   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, this->qos_);
00047 
00048   return this->qos_;
00049 }

ACE_INLINE const RtecEventChannelAdmin::SupplierQOS & TAO_EC_ProxyPushConsumer::publications_i void   )  const
 

The QoS (subscription) used to connect to the EC, assumes the locks are held, use with care!

Definition at line 52 of file EC_ProxyConsumer.inl.

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

00053 {
00054   return this->qos_;
00055 }

void TAO_EC_ProxyPushConsumer::reconnected TAO_EC_ProxyPushConsumer consumer  )  [virtual]
 

Definition at line 120 of file EC_ProxyConsumer.cpp.

00121 {
00122 }

void TAO_EC_ProxyPushConsumer::reconnected TAO_EC_ProxyPushSupplier supplier  )  [virtual]
 

Definition at line 89 of file EC_ProxyConsumer.cpp.

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

00090 {
00091   TAO_EC_ProxyPushConsumer_Guard ace_mon (this->lock_,
00092                                           this->refcount_,
00093                                           this->event_channel_,
00094                                           this);
00095   if (!ace_mon.locked ())
00096     return;
00097 
00098   ace_mon.filter->reconnected (supplier);
00099 }

void TAO_EC_ProxyPushConsumer::refcount_zero_hook void   )  [private, virtual]
 

Definition at line 214 of file EC_ProxyConsumer.cpp.

References TAO_EC_Event_Channel_Base::destroy_proxy().

Referenced by _decr_refcnt(), and TAO_EC_ProxyPushConsumer_Guard::~TAO_EC_ProxyPushConsumer_Guard().

00215 {
00216   // Use the event channel
00217   this->event_channel_->destroy_proxy (this);
00218 }

void TAO_EC_ProxyPushConsumer::shutdown void   )  [virtual]
 

The event channel is shutting down.

Definition at line 135 of file EC_ProxyConsumer.cpp.

References ACE_GUARD_THROW_EX, cleanup_i(), connected_, deactivate(), filter_, CORBA::is_nil(), TAO_EC_Supplier_Filter::shutdown(), shutdown_hook(), and supplier().

00136 {
00137   RtecEventComm::PushSupplier_var supplier;
00138 
00139   {
00140     ACE_GUARD_THROW_EX (
00141         ACE_Lock, ace_mon, *this->lock_,
00142         RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00143 
00144     supplier = this->supplier_._retn ();
00145     this->connected_ = 0;
00146 
00147     this->shutdown_hook ();
00148 
00149     if (this->filter_ != 0)
00150       {
00151         this->filter_->shutdown ();
00152 
00153         this->cleanup_i ();
00154       }
00155   }
00156 
00157   this->deactivate ();
00158 
00159   if (CORBA::is_nil (supplier.in ()))
00160     return;
00161 
00162   try
00163     {
00164       supplier->disconnect_push_supplier ();
00165     }
00166   catch (const CORBA::Exception&)
00167     {
00168       // Ignore exceptions, we must isolate other clients from
00169       // failures on this one.
00170     }
00171 }

void TAO_EC_ProxyPushConsumer::shutdown_hook void   )  [private, virtual]
 

Template method hooks.

Definition at line 130 of file EC_ProxyConsumer.cpp.

Referenced by shutdown().

00131 {
00132 }

ACE_INLINE void TAO_EC_ProxyPushConsumer::supplier RtecEventComm::PushSupplier_ptr  supplier  )  [protected]
 

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

Definition at line 35 of file EC_ProxyConsumer.inl.

References ACE_GUARD, and supplier_i().

00036 {
00037   ACE_GUARD (ACE_Lock, ace_mon, *this->lock_);
00038 
00039   this->supplier_i (supplier);
00040 }

ACE_INLINE RtecEventComm::PushSupplier_ptr TAO_EC_ProxyPushConsumer::supplier void   )  const
 

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

Definition at line 22 of file EC_ProxyConsumer.inl.

References ACE_GUARD_RETURN.

Referenced by shutdown(), and supplier_non_existent().

00023 {
00024   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00025   return RtecEventComm::PushSupplier::_duplicate (this->supplier_.in ());
00026 }

ACE_INLINE void TAO_EC_ProxyPushConsumer::supplier_i RtecEventComm::PushSupplier_ptr  supplier  )  [protected]
 

Definition at line 29 of file EC_ProxyConsumer.inl.

Referenced by supplier().

00030 {
00031   this->supplier_ = supplier;
00032 }

CORBA::Boolean TAO_EC_ProxyPushConsumer::supplier_non_existent CORBA::Boolean_out  disconnected  ) 
 

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

Definition at line 46 of file EC_ProxyConsumer.cpp.

References CORBA::Object::_duplicate(), ACE_GUARD_THROW_EX, is_connected_i(), CORBA::is_nil(), and supplier().

Referenced by TAO_EC_Ping_Supplier::work().

00048 {
00049   CORBA::Object_var supplier;
00050   {
00051     ACE_GUARD_THROW_EX (
00052         ACE_Lock, ace_mon, *this->lock_,
00053         CORBA::INTERNAL ());
00054 
00055     disconnected = 0;
00056     if (this->is_connected_i () == 0)
00057       {
00058         disconnected = 1;
00059         return 0;
00060       }
00061     if (CORBA::is_nil (this->supplier_.in ()))
00062       {
00063         return 0;
00064       }
00065     supplier = CORBA::Object::_duplicate (this->supplier_.in ());
00066   }
00067 
00068 #if (TAO_HAS_MINIMUM_CORBA == 0)
00069   return supplier->_non_existent ();
00070 #else
00071   return 0;
00072 #endif /* TAO_HAS_MINIMUM_CORBA */
00073 }


Friends And Related Function Documentation

friend class TAO_EC_ProxyPushConsumer_Guard [friend]
 

Definition at line 127 of file EC_ProxyConsumer.h.


Member Data Documentation

int TAO_EC_ProxyPushConsumer::connected_ [protected]
 

If the flag is not zero then we are connected, notice that the supplier can be nil.

Definition at line 153 of file EC_ProxyConsumer.h.

Referenced by cleanup_i(), is_connected_i(), and shutdown().

PortableServer::POA_var TAO_EC_ProxyPushConsumer::default_POA_ [protected]
 

Store the default POA.

Definition at line 159 of file EC_ProxyConsumer.h.

TAO_EC_Event_Channel_Base* TAO_EC_ProxyPushConsumer::event_channel_ [protected]
 

The supplier admin, used for activation and memory managment.

Definition at line 140 of file EC_ProxyConsumer.h.

TAO_EC_Supplier_Filter* TAO_EC_ProxyPushConsumer::filter_ [protected]
 

The strategy to do filtering close to the supplier.

Definition at line 162 of file EC_ProxyConsumer.h.

Referenced by cleanup_i(), filter_i(), and shutdown().

ACE_Lock* TAO_EC_ProxyPushConsumer::lock_ [protected]
 

The locking strategy.

Definition at line 143 of file EC_ProxyConsumer.h.

RtecEventChannelAdmin::SupplierQOS TAO_EC_ProxyPushConsumer::qos_ [protected]
 

The publication and QoS information...

Definition at line 156 of file EC_ProxyConsumer.h.

CORBA::ULong TAO_EC_ProxyPushConsumer::refcount_ [protected]
 

The reference count.

Definition at line 146 of file EC_ProxyConsumer.h.

RtecEventComm::PushSupplier_var TAO_EC_ProxyPushConsumer::supplier_ [protected]
 

The supplier....

Definition at line 149 of file EC_ProxyConsumer.h.


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 13:42:44 2008 for TAO_RTEvent by doxygen 1.3.6