Base class for all types of ProxyConsumer implementations. More...
#include <ProxyConsumer.h>
Public Types | |
typedef TAO_Notify_Refcountable_Guard_T < TAO_Notify_ProxyConsumer > | Ptr |
Public Member Functions | |
TAO_Notify_ProxyConsumer (void) | |
Constructor. | |
virtual | ~TAO_Notify_ProxyConsumer (void) |
Destructor. | |
virtual void | init (TAO_Notify::Topology_Parent *topology_parent) |
init: overrides Topology_Object method | |
void | connect (TAO_Notify_Supplier *supplier) |
Connect. | |
void | disconnect (void) |
Disconnect. | |
virtual int | shutdown (void) |
Shutdown (TAO_Notify_Container_T method). | |
virtual void | destroy (void) |
Destroy this object. | |
bool | is_connected (void) const |
Return true if connected. | |
TAO_Notify_SupplierAdmin & | supplier_admin (void) |
The SA parent. | |
ACE_Time_Value | last_ping () const |
void | last_ping (const ACE_Time_Value &tv) |
Protected Member Functions | |
TAO_Notify_Supplier * | supplier (void) |
Access the Supplier. | |
void | push_i (TAO_Notify_Event *event) |
Accept an event from the Supplier. | |
Protected Attributes | |
ACE_Atomic_Op< TAO_SYNCH_MUTEX, ACE_Time_Value > | last_ping_ |
Private Member Functions | |
bool | supports_reliable_events () const |
Is this part of a reliable channel. | |
virtual TAO_Notify_Peer * | peer (void) |
Access our Peer. | |
Private Attributes | |
TAO_Notify_SupplierAdmin::Ptr | supplier_admin_ |
ACE_Auto_Ptr< TAO_Notify_Supplier > | supplier_ |
The Supplier that we're connect to. |
Base class for all types of ProxyConsumer implementations.
Definition at line 39 of file ProxyConsumer.h.
Reimplemented from TAO_Notify_Proxy.
Definition at line 43 of file ProxyConsumer.h.
TAO_Notify_ProxyConsumer::TAO_Notify_ProxyConsumer | ( | void | ) |
TAO_Notify_ProxyConsumer::~TAO_Notify_ProxyConsumer | ( | void | ) | [virtual] |
void TAO_Notify_ProxyConsumer::connect | ( | TAO_Notify_Supplier * | supplier | ) |
Connect.
Definition at line 70 of file ProxyConsumer.cpp.
{ // Adopt the supplier ACE_Auto_Ptr< TAO_Notify_Supplier > auto_supplier (supplier); TAO_Notify_Atomic_Property_Long& supplier_count = this->admin_properties().suppliers (); const TAO_Notify_Property_Long& max_suppliers = this->admin_properties().max_suppliers (); if (max_suppliers != 0 && supplier_count >= max_suppliers.value ()) { throw CORBA::IMP_LIMIT ( ); // we've reached the limit of suppliers connected. } { ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, CORBA::INTERNAL ()); // if supplier is set and reconnect not allowed we get out. if (this->is_connected () && TAO_Notify_PROPERTIES::instance()->allow_reconnect() == false) { throw CosEventChannelAdmin::AlreadyConnected (); } // Adopt the supplier this->supplier_ = auto_supplier; this->supplier_admin_->subscribed_types (this->subscribed_types_); // get the parents subscribed types. } // Inform QoS values. ACE_ASSERT (this->supplier_.get() != 0); this->supplier_->qos_changed (this->qos_properties_); TAO_Notify_EventTypeSeq removed; this->event_manager().offer_change (this, this->subscribed_types_, removed); this->event_manager().connect (this); // Increment the global supplier count ++supplier_count; }
void TAO_Notify_ProxyConsumer::destroy | ( | void | ) | [virtual] |
Destroy this object.
Implements TAO_Notify_Proxy.
Definition at line 181 of file ProxyConsumer.cpp.
{ this->shutdown (); this->supplier_admin_->cleanup_proxy (this, false, false); // Do not reset this->supplier_. // It is not safe to delete the non-refcounted supplier here. }
void TAO_Notify_ProxyConsumer::disconnect | ( | void | ) |
Disconnect.
Definition at line 152 of file ProxyConsumer.cpp.
{ TAO_Notify_EventTypeSeq added; event_manager().offer_change (this, added, this->subscribed_types_); this->event_manager().disconnect (this); // Decrement the global supplier count this->admin_properties().suppliers ()--; }
void TAO_Notify_ProxyConsumer::init | ( | TAO_Notify::Topology_Parent * | topology_parent | ) | [virtual] |
init: overrides Topology_Object method
Definition at line 48 of file ProxyConsumer.cpp.
{ ACE_ASSERT( this->supplier_admin_.get() == 0 ); TAO_Notify_Proxy::initialize (topology_parent); this->supplier_admin_.reset (dynamic_cast<TAO_Notify_SupplierAdmin *>(topology_parent)); ACE_ASSERT (this->supplier_admin_.get() != 0); this->filter_admin_.event_channel (this->supplier_admin_->event_channel()); const CosNotification::QoSProperties &default_ps_qos = TAO_Notify_PROPERTIES::instance ()->default_proxy_consumer_qos_properties (); { ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, CORBA::INTERNAL ()); this->TAO_Notify_Object::set_qos (default_ps_qos); } }
bool TAO_Notify_ProxyConsumer::is_connected | ( | void | ) | const |
Return true if connected.
Definition at line 8 of file ProxyConsumer.inl.
ACE_Time_Value TAO_Notify_ProxyConsumer::last_ping | ( | ) | const |
Definition at line 192 of file ProxyConsumer.cpp.
{ return this->last_ping_.value (); }
void TAO_Notify_ProxyConsumer::last_ping | ( | const ACE_Time_Value & | tv | ) |
Definition at line 199 of file ProxyConsumer.cpp.
{ this->last_ping_ = tv; }
TAO_Notify_Peer * TAO_Notify_ProxyConsumer::peer | ( | void | ) | [private, virtual] |
Access our Peer.
Implements TAO_Notify_Proxy.
Definition at line 42 of file ProxyConsumer.cpp.
{ return this->supplier (); }
void TAO_Notify_ProxyConsumer::push_i | ( | TAO_Notify_Event * | event | ) | [protected] |
Accept an event from the Supplier.
Definition at line 114 of file ProxyConsumer.cpp.
{ last_ping_ = ACE_OS::gettimeofday (); if (this->supports_reliable_events ()) { TAO_Notify_Event::Ptr pevent(event->queueable_copy()); TAO_Notify::Routing_Slip_Ptr routing_slip = TAO_Notify::Routing_Slip::create (pevent); if (DEBUG_LEVEL > 0) ACE_DEBUG((LM_DEBUG, ACE_TEXT ("ProxyConsumer routing event.\n"))); routing_slip->route (this, true); routing_slip->wait_persist (); } else { TAO_Notify_Method_Request_Lookup_No_Copy request (event, this); this->execute_task (request); } }
int TAO_Notify_ProxyConsumer::shutdown | ( | void | ) | [virtual] |
Shutdown (TAO_Notify_Container_T method).
Definition at line 165 of file ProxyConsumer.cpp.
{ if (this->TAO_Notify_Object::shutdown () == 1) return 1; this->disconnect (); if (this->supplier_.get() != 0) { this->supplier_->shutdown (); } return 0; }
TAO_Notify_Supplier * TAO_Notify_ProxyConsumer::supplier | ( | void | ) | [protected] |
Access the Supplier.
Definition at line 14 of file ProxyConsumer.inl.
TAO_Notify_SupplierAdmin & TAO_Notify_ProxyConsumer::supplier_admin | ( | void | ) |
The SA parent.
Definition at line 20 of file ProxyConsumer.inl.
{ ACE_ASSERT( this->supplier_admin_.get() != 0 ); return *this->supplier_admin_; }
bool TAO_Notify_ProxyConsumer::supports_reliable_events | ( | ) | const [private] |
Is this part of a reliable channel.
Definition at line 136 of file ProxyConsumer.cpp.
{ bool reliable = false; CosNotification::PropertyValue value; if (this->find_qos_property_value (CosNotification::EventReliability, value)) { CORBA::Short setting; if (value >>= setting) { reliable = (setting == CosNotification::Persistent); } } return reliable; }
ACE_Atomic_Op<TAO_SYNCH_MUTEX, ACE_Time_Value> TAO_Notify_ProxyConsumer::last_ping_ [protected] |
Last time either push an event or validate connection via _non_exist call.
Definition at line 83 of file ProxyConsumer.h.
The Supplier that we're connect to.
Definition at line 94 of file ProxyConsumer.h.
= Data Members. The SA parent.
Definition at line 91 of file ProxyConsumer.h.