TAO_Notify_ProxySupplier Class Reference

Base class for all the ProxySuppliers. More...

#include <ProxySupplier.h>

Inheritance diagram for TAO_Notify_ProxySupplier:

Inheritance graph
[legend]
Collaboration diagram for TAO_Notify_ProxySupplier:

Collaboration graph
[legend]
List of all members.

Public Types

typedef TAO_Notify_Refcountable_Guard_T<
TAO_Notify_ProxySupplier
Ptr

Public Member Functions

 TAO_Notify_ProxySupplier (void)
 Constructor.
virtual ~TAO_Notify_ProxySupplier ()
 Destructor.
virtual void init (TAO_Notify_ConsumerAdmin *consumer_admin)
 Init.
void connect (TAO_Notify_Consumer *consumer)
 Connect.
void disconnect (void)
 Disconnect.
virtual void deliver (TAO_Notify_Method_Request_Dispatch_No_Copy &request)
 Dispatch Event to consumer.
virtual int shutdown (void)
 Override TAO_Notify_Container_T::shutdown method.
virtual void destroy (void)
 Destroy this object.
virtual void qos_changed (const TAO_Notify_QoSProperties &qos_properties)
 Override, TAO_Notify_Proxy::qos_changed to apply MaxEventssPerConsumer QoS.
bool is_connected (void) const
 Returns true if connected.
TAO_Notify_Consumerconsumer (void)
 Access the Consumer.
TAO_Notify_ConsumerAdminconsumer_admin (void)
 The CA parent.

Private Member Functions

virtual TAO_Notify_Peerpeer (void)
 Access our Peer.

Private Attributes

TAO_Notify_ConsumerAdmin::Ptr consumer_admin_
ACE_Auto_Ptr< TAO_Notify_Consumerconsumer_
 The Consumer that we're connect to.

Friends

class TAO_Notify_Consumer

Detailed Description

Base class for all the ProxySuppliers.

Definition at line 37 of file ProxySupplier.h.


Member Typedef Documentation

typedef TAO_Notify_Refcountable_Guard_T<TAO_Notify_ProxySupplier> TAO_Notify_ProxySupplier::Ptr

Reimplemented from TAO_Notify_Proxy.

Definition at line 42 of file ProxySupplier.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Notify_ProxySupplier::TAO_Notify_ProxySupplier ( void   ) 

Constructor.

Definition at line 22 of file ProxySupplier.cpp.

00023   : consumer_admin_ (0)
00024 {
00025 }

TAO_Notify_ProxySupplier::~TAO_Notify_ProxySupplier (  )  [virtual]

Destructor.

Definition at line 27 of file ProxySupplier.cpp.

00028 {
00029 }


Member Function Documentation

void TAO_Notify_ProxySupplier::connect ( TAO_Notify_Consumer consumer  ) 

Connect.

Definition at line 57 of file ProxySupplier.cpp.

References ACE_ASSERT, ACE_GUARD_THROW_EX, TAO_Notify_Object::admin_properties(), TAO_Notify_Properties::allow_reconnect(), TAO_Notify_Event_Manager::connect(), consumer(), consumer_, consumer_admin_, TAO_Notify_AdminProperties::consumers(), TAO_Notify_Object::event_manager(), TAO_Notify_Properties::instance(), TAO_Notify_AdminProperties::max_consumers(), TAO_Notify_Event_Manager::subscription_change(), TAO_SYNCH_MUTEX, and TAO_Notify_PropertyBase_T< TYPE >::value().

Referenced by TAO_Notify_ProxyPushSupplier::connect_any_push_consumer(), TAO_Notify_CosEC_ProxyPushSupplier::connect_push_consumer(), TAO_Notify_SequenceProxyPushSupplier::connect_sequence_push_consumer(), and TAO_Notify_StructuredProxyPushSupplier::connect_structured_push_consumer().

00058 {
00059   // Adopt the consumer
00060   ACE_Auto_Ptr< TAO_Notify_Consumer > auto_consumer (consumer);
00061 
00062   TAO_Notify_Atomic_Property_Long& consumer_count = this->admin_properties().consumers ();
00063   const TAO_Notify_Property_Long& max_consumers = this->admin_properties().max_consumers ();
00064 
00065   if (max_consumers != 0 && consumer_count >= max_consumers.value ())
00066   {
00067     throw CORBA::IMP_LIMIT (
00068       ); // we've reached the limit of consumers connected.
00069   }
00070 
00071   {
00072     ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
00073                         CORBA::INTERNAL ());
00074 
00075     // if consumer is set and reconnect not allowed we get out.
00076     if (this->is_connected () && TAO_Notify_PROPERTIES::instance()->allow_reconnect() == false)
00077       {
00078           throw CosEventChannelAdmin::AlreadyConnected ();
00079       }
00080 
00081     // Adopt the consumer
00082     if (this->consumer_.get() != 0)
00083       auto_consumer->assume_pending_events (*this->consumer_.get ());
00084     this->consumer_ = auto_consumer;
00085 
00086     this->consumer_admin_->subscribed_types (this->subscribed_types_); // get the parents subscribed types.
00087   }
00088 
00089   // Inform QoS values.
00090   ACE_ASSERT (this->consumer_.get() != 0);
00091   this->consumer_->qos_changed (this->qos_properties_);
00092 
00093   TAO_Notify_EventTypeSeq removed;
00094 
00095   this->event_manager().subscription_change (this, this->subscribed_types_, removed);
00096 
00097   this->event_manager().connect (this);
00098 
00099   // Increment the global consumer count
00100   ++consumer_count;
00101 }

ACE_INLINE TAO_Notify_Consumer * TAO_Notify_ProxySupplier::consumer ( void   ) 

Access the Consumer.

Definition at line 14 of file ProxySupplier.inl.

References consumer_, and ACE_Auto_Basic_Ptr< X >::get().

Referenced by connect(), TAO_Notify_ProxyPushSupplier::connect_any_push_consumer(), TAO_Notify_CosEC_ProxyPushSupplier::connect_push_consumer(), TAO_Notify_SequenceProxyPushSupplier::connect_sequence_push_consumer(), TAO_Notify_StructuredProxyPushSupplier::connect_structured_push_consumer(), peer(), TAO_Notify_ProxySupplier_T< SERVANT_TYPE >::resume_connection(), and TAO_Notify_ProxySupplier_T< SERVANT_TYPE >::suspend_connection().

00015 {
00016   return this->consumer_.get();
00017 }

ACE_INLINE TAO_Notify_ConsumerAdmin & TAO_Notify_ProxySupplier::consumer_admin ( void   ) 

The CA parent.

Definition at line 20 of file ProxySupplier.inl.

References ACE_ASSERT, and consumer_admin_.

Referenced by init(), and TAO_Notify_ProxySupplier_T< SERVANT_TYPE >::MyAdmin().

00021 {
00022   ACE_ASSERT( this->consumer_admin_.get() != 0 );
00023   return *this->consumer_admin_;
00024 }

void TAO_Notify_ProxySupplier::deliver ( TAO_Notify_Method_Request_Dispatch_No_Copy request  )  [virtual]

Dispatch Event to consumer.

Reimplemented in TAO_Notify_RT_StructuredProxyPushSupplier.

Definition at line 143 of file ProxySupplier.cpp.

References TAO_Notify_Object::execute_task().

Referenced by TAO_Notify_Method_Request_Lookup::work().

00144 {
00145   this->execute_task (request);
00146 }

void TAO_Notify_ProxySupplier::destroy ( void   )  [virtual]

Destroy this object.

Implements TAO_Notify_Proxy.

Definition at line 133 of file ProxySupplier.cpp.

References consumer_admin_, and shutdown().

Referenced by TAO_Notify_Consumer::deliver(), TAO_Notify_ProxyPushSupplier::disconnect_push_supplier(), TAO_Notify_CosEC_ProxyPushSupplier::disconnect_push_supplier(), TAO_Notify_SequenceProxyPushSupplier::disconnect_sequence_push_supplier(), TAO_Notify_StructuredProxyPushSupplier::disconnect_structured_push_supplier(), TAO_Notify_SequencePushConsumer::dispatch_from_queue(), and TAO_Notify_Consumer::dispatch_from_queue().

00134 {
00135   this->shutdown ();
00136   this->consumer_admin_->cleanup_proxy (this, true);
00137 
00138   // Do not reset this->consumer_.
00139   // It is not safe to delete the non-refcounted consumer here.
00140 }

void TAO_Notify_ProxySupplier::disconnect ( void   ) 

Disconnect.

Definition at line 104 of file ProxySupplier.cpp.

References TAO_Notify_Object::admin_properties(), TAO_Notify_AdminProperties::consumers(), TAO_Notify_Event_Manager::disconnect(), TAO_Notify_Object::event_manager(), and TAO_Notify_Event_Manager::subscription_change().

Referenced by shutdown().

00105 {
00106   TAO_Notify_EventTypeSeq added;
00107 
00108   this->event_manager().subscription_change (this, added, this->subscribed_types_);
00109 
00110   this->event_manager().disconnect (this);
00111 
00112   // Decrement the global consumer count
00113   this->admin_properties().consumers ()--;
00114 }

void TAO_Notify_ProxySupplier::init ( TAO_Notify_ConsumerAdmin consumer_admin  )  [virtual]

Init.

Definition at line 32 of file ProxySupplier.cpp.

References ACE_ASSERT, ACE_GUARD_THROW_EX, consumer_admin(), consumer_admin_, TAO_Notify_Properties::default_proxy_supplier_qos_properties(), TAO_Notify::Topology_Object::initialize(), TAO_Notify_Properties::instance(), TAO_Notify_Refcountable_Guard_T< T >::reset(), TAO_Notify_Object::set_qos(), and TAO_SYNCH_MUTEX.

00033 {
00034   ACE_ASSERT (consumer_admin != 0 && this->consumer_admin_.get() == 0);
00035 
00036   TAO_Notify_Proxy::initialize (consumer_admin);
00037 
00038   this->consumer_admin_.reset (consumer_admin);
00039 
00040   const CosNotification::QoSProperties &default_ps_qos =
00041     TAO_Notify_PROPERTIES::instance ()->default_proxy_supplier_qos_properties ();
00042 
00043   {
00044     ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
00045                           CORBA::INTERNAL ());
00046     this->TAO_Notify_Object::set_qos (default_ps_qos);
00047   }
00048 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE bool TAO_Notify_ProxySupplier::is_connected ( void   )  const

Returns true if connected.

Definition at line 8 of file ProxySupplier.inl.

00009 {
00010   return ( this->consumer_.get() != 0 );
00011 }

TAO_Notify_Peer * TAO_Notify_ProxySupplier::peer ( void   )  [private, virtual]

Access our Peer.

Implements TAO_Notify_Proxy.

Definition at line 51 of file ProxySupplier.cpp.

References consumer().

00052 {
00053   return this->consumer ();
00054 }

void TAO_Notify_ProxySupplier::qos_changed ( const TAO_Notify_QoSProperties qos_properties  )  [virtual]

Override, TAO_Notify_Proxy::qos_changed to apply MaxEventssPerConsumer QoS.

Reimplemented from TAO_Notify_Proxy.

Definition at line 149 of file ProxySupplier.cpp.

References TAO_Notify_Proxy::qos_changed().

00150 {
00151   TAO_Notify_Proxy::qos_changed (qos_properties);
00152 }

int TAO_Notify_ProxySupplier::shutdown ( void   )  [virtual]

Override TAO_Notify_Container_T::shutdown method.

Reimplemented from TAO_Notify_Object.

Definition at line 117 of file ProxySupplier.cpp.

References disconnect().

Referenced by destroy().

00118 {
00119   if (this->TAO_Notify_Object::shutdown () == 1)
00120     return 1;
00121 
00122 
00123   this->disconnect ();
00124 
00125   if (this->consumer_.get() != 0)
00126   {
00127     this->consumer_->shutdown ();
00128   }
00129   return 0;
00130 }


Friends And Related Function Documentation

friend class TAO_Notify_Consumer [friend]

Definition at line 39 of file ProxySupplier.h.


Member Data Documentation

ACE_Auto_Ptr<TAO_Notify_Consumer> TAO_Notify_ProxySupplier::consumer_ [private]

The Consumer that we're connect to.

Definition at line 84 of file ProxySupplier.h.

Referenced by connect(), and consumer().

TAO_Notify_ConsumerAdmin::Ptr TAO_Notify_ProxySupplier::consumer_admin_ [private]

= Data Members. The CA parent.

Definition at line 81 of file ProxySupplier.h.

Referenced by connect(), consumer_admin(), destroy(), and init().


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