#include <ProxyConsumer.h>
Inheritance diagram for TAO_Notify_ProxyConsumer:


Public Types | |
| typedef TAO_Notify_Refcountable_Guard_T< TAO_Notify_ProxyConsumer > | Ptr |
Public Member Functions | |
| TAO_Notify_ProxyConsumer (void) | |
| Constuctor. | |
| virtual | ~TAO_Notify_ProxyConsumer () |
| Destructor. | |
| virtual void | init (TAO_Notify::Topology_Parent *topology_parent) |
| init: overrides Topology_Object method | |
| void | connect (TAO_Notify_Supplier *supplier) throw ( CORBA::SystemException , CosEventChannelAdmin::AlreadyConnected ) |
| Connect. | |
| void | disconnect () |
| Disconnect. | |
| virtual int | shutdown () |
| Shutdown (TAO_Notify_Container_T method). | |
| virtual void | destroy () |
| Destroy this object. | |
| bool | is_connected (void) const |
| Return 1 if connected. | |
| TAO_Notify_SupplierAdmin & | supplier_admin (void) |
| The SA parent. | |
Protected Member Functions | |
| TAO_Notify_Supplier * | supplier (void) |
| Access the Supplier. | |
| void | push_i (TAO_Notify_Event *event) |
| Accept an event from the Supplier. | |
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. | |
Definition at line 39 of file ProxyConsumer.h.
|
|
Reimplemented from TAO_Notify_Proxy. Definition at line 43 of file ProxyConsumer.h. |
|
|
Constuctor.
Definition at line 32 of file ProxyConsumer.cpp.
00033 : supplier_admin_ (0) 00034 { 00035 } |
|
|
Destructor.
Definition at line 37 of file ProxyConsumer.cpp.
00038 {
00039 }
|
|
|
Connect.
Definition at line 65 of file ProxyConsumer.cpp. References ACE_ASSERT, ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_GUARD_THROW_EX, ACE_THROW, TAO_Singleton< TYPE, ACE_LOCK >::instance(), TAO_Notify_Atomic_Property_Long, TAO_Notify_Property_Long, TAO_SYNCH_MUTEX, and TAO_Notify_PropertyBase_T< TYPE >::value().
00070 {
00071 // Adopt the supplier
00072 ACE_Auto_Ptr< TAO_Notify_Supplier > auto_supplier (supplier);
00073
00074 TAO_Notify_Atomic_Property_Long& supplier_count = this->admin_properties().suppliers ();
00075 const TAO_Notify_Property_Long& max_suppliers = this->admin_properties().max_suppliers ();
00076
00077 if (max_suppliers != 0 && supplier_count >= max_suppliers.value ())
00078 {
00079 ACE_THROW (CORBA::IMP_LIMIT ()); // we've reached the limit of suppliers connected.
00080 }
00081
00082 {
00083 ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
00084 CORBA::INTERNAL ());
00085 ACE_CHECK;
00086
00087 // if supplier is set and reconnect not allowed we get out.
00088 if (this->is_connected () && TAO_Notify_PROPERTIES::instance()->allow_reconnect() == false)
00089 {
00090 ACE_THROW (CosEventChannelAdmin::AlreadyConnected ());
00091 }
00092
00093 // Adopt the supplier
00094 this->supplier_ = auto_supplier;
00095
00096 this->supplier_admin_->subscribed_types (this->subscribed_types_ ACE_ENV_ARG_PARAMETER); // get the parents subscribed types.
00097 ACE_CHECK;
00098 }
00099
00100 // Inform QoS values.
00101 ACE_ASSERT (this->supplier_.get() != 0);
00102 this->supplier_->qos_changed (this->qos_properties_);
00103
00104 TAO_Notify_EventTypeSeq removed;
00105
00106 this->event_manager().offer_change (this, this->subscribed_types_, removed ACE_ENV_ARG_PARAMETER);
00107 ACE_CHECK;
00108
00109 this->event_manager().connect (this ACE_ENV_ARG_PARAMETER);
00110 ACE_CHECK;
00111
00112 // Increment the global supplier count
00113 ++supplier_count;
00114 }
|
|
|
Destroy this object.
Implements TAO_Notify_Proxy. Definition at line 190 of file ProxyConsumer.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, and shutdown().
00191 {
00192 int result = this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
00193 ACE_CHECK;
00194 if ( result == 1)
00195 return;
00196
00197 this->supplier_admin_->remove (this ACE_ENV_ARG_PARAMETER);
00198 ACE_CHECK;
00199
00200 // Do not reset this->supplier_.
00201 // It is not safe to delete the non-refcounted supplier here.
00202 }
|
|
|
Disconnect.
Definition at line 156 of file ProxyConsumer.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, TAO_Notify_Object::admin_properties(), TAO_Notify_Event_Manager::disconnect(), TAO_Notify_Object::event_manager(), TAO_Notify_Event_Manager::offer_change(), and TAO_Notify_AdminProperties::suppliers(). Referenced by shutdown().
00157 {
00158 TAO_Notify_EventTypeSeq added;
00159
00160 event_manager().offer_change (this, added, this->subscribed_types_ ACE_ENV_ARG_PARAMETER);
00161 ACE_CHECK;
00162
00163 this->event_manager().disconnect (this ACE_ENV_ARG_PARAMETER);
00164 ACE_CHECK;
00165
00166 // Decrement the global supplier count
00167 this->admin_properties().suppliers ()--;
00168 }
|
|
|
init: overrides Topology_Object method
Definition at line 48 of file ProxyConsumer.cpp. References ACE_ASSERT, ACE_CHECK, ACE_ENV_ARG_PARAMETER, TAO_Notify::Topology_Object::initialize(), TAO_Singleton< TYPE, ACE_LOCK >::instance(), CosNotification::QoSProperties, and TAO_Notify_Object::set_qos().
00049 {
00050 ACE_ASSERT( this->supplier_admin_.get() == 0 );
00051
00052 TAO_Notify_Proxy::initialize (topology_parent ACE_ENV_ARG_PARAMETER);
00053 ACE_CHECK;
00054
00055 this->supplier_admin_.reset (dynamic_cast<TAO_Notify_SupplierAdmin *>(topology_parent));
00056 ACE_ASSERT (this->supplier_admin_.get() != 0);
00057
00058 const CosNotification::QoSProperties &default_ps_qos =
00059 TAO_Notify_PROPERTIES::instance ()->default_proxy_consumer_qos_properties ();
00060
00061 this->set_qos (default_ps_qos ACE_ENV_ARG_PARAMETER);
00062 }
|
|
|
Return 1 if connected.
Definition at line 8 of file ProxyConsumer.inl. References ACE_Auto_Basic_Ptr< X >::get().
|
|
|
Access our Peer.
Implements TAO_Notify_Proxy. Definition at line 42 of file ProxyConsumer.cpp. References supplier().
00043 {
00044 return this->supplier ();
00045 }
|
|
|
Accept an event from the Supplier.
Definition at line 116 of file ProxyConsumer.cpp. References ACE_CHECK, ACE_DEBUG, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_TEXT(), TAO_Notify::Routing_Slip::create(), DEBUG_LEVEL, TAO_Notify_Object::execute_task(), LM_DEBUG, TAO_Notify::Routing_Slip_Ptr, and supports_reliable_events().
00117 {
00118 if (this->supports_reliable_events ())
00119 {
00120 TAO_Notify_Event::Ptr pevent(event->queueable_copy(ACE_ENV_SINGLE_ARG_PARAMETER));
00121 ACE_CHECK;
00122 TAO_Notify::Routing_Slip_Ptr routing_slip =
00123 TAO_Notify::Routing_Slip::create (pevent ACE_ENV_ARG_PARAMETER);
00124 ACE_CHECK;
00125 if (DEBUG_LEVEL > 0)
00126 ACE_DEBUG((LM_DEBUG, ACE_TEXT ("ProxyConsumer routing event.\n")));
00127 routing_slip->route (this, true ACE_ENV_ARG_PARAMETER);
00128 ACE_CHECK;
00129 routing_slip->wait_persist ();
00130 }
00131 else
00132 {
00133 TAO_Notify_Method_Request_Lookup_No_Copy request (event, this);
00134 this->execute_task (request ACE_ENV_ARG_PARAMETER);
00135 ACE_CHECK;
00136 }
00137 }
|
|
|
Shutdown (TAO_Notify_Container_T method).
Reimplemented from TAO_Notify_Object. Definition at line 171 of file ProxyConsumer.cpp. References ACE_CHECK_RETURN, ACE_ENV_SINGLE_ARG_PARAMETER, disconnect(), ACE_Auto_Basic_Ptr< X >::get(), and TAO_Notify_Object::shutdown(). Referenced by destroy().
00172 {
00173 if (this->TAO_Notify_Object::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1)
00174 return 1;
00175
00176 ACE_CHECK_RETURN (1);
00177
00178 this->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
00179 ACE_CHECK_RETURN (1);
00180
00181 if (this->supplier_.get() != 0)
00182 {
00183 this->supplier_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
00184 ACE_CHECK_RETURN (1);
00185 }
00186 return 0;
00187 }
|
|
|
Access the Supplier.
Definition at line 14 of file ProxyConsumer.inl. References ACE_Auto_Basic_Ptr< X >::get(). Referenced by peer().
|
|
|
The SA parent.
Definition at line 20 of file ProxyConsumer.inl. References ACE_ASSERT. Referenced by TAO_Notify_Method_Request_Lookup::execute_i().
00021 {
00022 ACE_ASSERT( this->supplier_admin_.get() != 0 );
00023 return *this->supplier_admin_;
00024 }
|
|
|
Is this part of a reliable channel.
Definition at line 140 of file ProxyConsumer.cpp. References TAO_Notify_Object::find_qos_property_value(), and CosNotification::PropertyValue. Referenced by push_i().
00141 {
00142 bool reliable = false;
00143 CosNotification::PropertyValue value;
00144 if (this->find_qos_property_value (CosNotification::EventReliability, value))
00145 {
00146 CORBA::Long setting;
00147 if (value >>= setting)
00148 {
00149 reliable = (setting == CosNotification::Persistent);
00150 }
00151 }
00152 return reliable;
00153 }
|
|
|
The Supplier that we're connect to.
Definition at line 92 of file ProxyConsumer.h. |
|
|
= Data Members. The SA parent. Definition at line 89 of file ProxyConsumer.h. |
1.3.6