#include <CEC_ProxyPullSupplier.h>
Collaboration diagram for TAO_CEC_ProxyPullSupplier:

Public Types | |
| typedef CosEventChannelAdmin::ProxyPullSupplier_ptr | _ptr_type |
| typedef CosEventChannelAdmin::ProxyPullSupplier_var | _var_type |
Public Member Functions | |
| TAO_CEC_ProxyPullSupplier (TAO_CEC_EventChannel *event_channel) | |
| constructor... | |
| virtual | ~TAO_CEC_ProxyPullSupplier (void) |
| destructor... | |
| virtual void | activate (CosEventChannelAdmin::ProxyPullSupplier_ptr &activated_proxy ACE_ENV_ARG_DECL) throw (CORBA::SystemException) |
| Activate in the POA. | |
| virtual void | deactivate (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException) |
| Deactivate from the POA. | |
| CORBA::Boolean | is_connected (void) const |
| Return 0 if no consumer is connected... | |
| CosEventComm::PullConsumer_ptr | consumer (void) const |
| virtual void | shutdown (ACE_ENV_SINGLE_ARG_DECL) |
| The event channel is shutting down. | |
| CORBA::Boolean | consumer_non_existent (CORBA::Boolean_out disconnected ACE_ENV_ARG_DECL) |
| void | push (const CORBA::Any &event ACE_ENV_ARG_DECL) |
| Push an event into the queue. | |
| virtual void | connect_pull_consumer (CosEventComm::PullConsumer_ptr pull_consumer ACE_ENV_ARG_DECL_NOT_USED) throw (CORBA::SystemException, CosEventChannelAdmin::AlreadyConnected) |
| virtual CORBA::Any * | pull (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) throw (CORBA::SystemException,CosEventComm::Disconnected) |
| virtual CORBA::Any * | try_pull (CORBA::Boolean_out has_event ACE_ENV_ARG_DECL_NOT_USED) throw (CORBA::SystemException,CosEventComm::Disconnected) |
| virtual void | disconnect_pull_supplier (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) throw (CORBA::SystemException) |
| CORBA::ULong | _incr_refcnt (void) |
| Increment and decrement the reference count. | |
| CORBA::ULong | _decr_refcnt (void) |
| virtual PortableServer::POA_ptr | _default_POA (ACE_ENV_SINGLE_ARG_DECL) |
| virtual void | _add_ref (ACE_ENV_SINGLE_ARG_DECL) |
| virtual void | _remove_ref (ACE_ENV_SINGLE_ARG_DECL) |
Protected Member Functions | |
| void | consumer (CosEventComm::PullConsumer_ptr consumer) |
| void | consumer_i (CosEventComm::PullConsumer_ptr consumer) |
| CORBA::Boolean | is_connected_i (void) const |
| The private version (without locking) of is_connected(). | |
| void | cleanup_i (void) |
| Release the child and the consumer. | |
Private Attributes | |
| TAO_CEC_EventChannel * | event_channel_ |
| The Event Channel that owns this object. | |
| ACE_Lock * | lock_ |
| The locking strategy. | |
| CORBA::ULong | refcount_ |
| The reference count. | |
| CosEventComm::PullConsumer_var | consumer_ |
| The consumer.... | |
| int | connected_ |
| PortableServer::POA_var | default_POA_ |
| Store the default POA. | |
| TAO_SYNCH_MUTEX | queue_lock_ |
| Use a message queue to pass the. | |
| TAO_SYNCH_CONDITION | wait_not_empty_ |
| ACE_Unbounded_Queue< CORBA::Any > | queue_ |
Implement the CosEventChannelAdmin::ProxyPullSupplier interface, remember that this class is used to communicate with a PullConsumer, so, in effect, this is the ambassador for a consumer inside the event channel. = MEMORY MANAGMENT It does not assume ownership of the TAO_CEC_Dispatching object. It makes a copy of the ConsumerQOS and the consumer object reference. = LOCKING Locking is strategized, the event channel acts as a factory for the locking strategies.
Definition at line 53 of file CEC_ProxyPullSupplier.h.
|
|
Definition at line 56 of file CEC_ProxyPullSupplier.h. |
|
|
Definition at line 57 of file CEC_ProxyPullSupplier.h. |
|
|
constructor...
Definition at line 21 of file CEC_ProxyPullSupplier.cpp. References TAO_CEC_EventChannel::create_supplier_lock(), TAO_CEC_EventChannel::get_servant_retry_map(), and TAO_CEC_EventChannel::supplier_poa().
00022 : event_channel_ (ec), 00023 refcount_ (1), 00024 connected_ (0), 00025 wait_not_empty_ (queue_lock_) 00026 { 00027 this->lock_ = 00028 this->event_channel_->create_supplier_lock (); 00029 00030 this->default_POA_ = 00031 this->event_channel_->supplier_poa (); 00032 00033 this->event_channel_->get_servant_retry_map ().bind (this, 0); 00034 } |
|
|
destructor...
Definition at line 36 of file CEC_ProxyPullSupplier.cpp. References TAO_CEC_EventChannel::destroy_supplier_lock(), and TAO_CEC_EventChannel::get_servant_retry_map().
00037 {
00038 this->event_channel_->get_servant_retry_map ().unbind (this);
00039 this->event_channel_->destroy_supplier_lock (this->lock_);
00040 }
|
|
|
Definition at line 350 of file CEC_ProxyPullSupplier.cpp. References _incr_refcnt().
00351 {
00352 this->_incr_refcnt ();
00353 }
|
|
|
Definition at line 232 of file CEC_ProxyPullSupplier.cpp. References ACE_GUARD_RETURN, and TAO_CEC_EventChannel::destroy_proxy(). Referenced by _remove_ref().
00233 {
00234 {
00235 ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00236 this->refcount_--;
00237 if (this->refcount_ != 0)
00238 return this->refcount_;
00239 }
00240
00241 // Notify the event channel
00242 this->event_channel_->destroy_proxy (this);
00243 return 0;
00244 }
|
|
|
Definition at line 344 of file CEC_ProxyPullSupplier.cpp.
00345 {
00346 return PortableServer::POA::_duplicate (this->default_POA_.in ());
00347 }
|
|
|
Increment and decrement the reference count.
Definition at line 225 of file CEC_ProxyPullSupplier.cpp. References ACE_GUARD_RETURN. Referenced by _add_ref().
00226 {
00227 ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00228 return this->refcount_++;
00229 }
|
|
|
Definition at line 356 of file CEC_ProxyPullSupplier.cpp. References _decr_refcnt().
00357 {
00358 this->_decr_refcnt ();
00359 }
|
|
|
Activate in the POA.
Definition at line 43 of file CEC_ProxyPullSupplier.cpp. References ACE_CATCHANY, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_TRY, and ACE_TRY_CHECK.
00047 {
00048 CosEventChannelAdmin::ProxyPullSupplier_var result;
00049 ACE_TRY
00050 {
00051 result = this->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
00052 ACE_TRY_CHECK;
00053 }
00054 ACE_CATCHANY
00055 {
00056 result = CosEventChannelAdmin::ProxyPullSupplier::_nil ();
00057 }
00058 ACE_ENDTRY;
00059 activated_proxy = result._retn ();
00060 }
|
|
|
Release the child and the consumer.
Definition at line 217 of file CEC_ProxyPullSupplier.cpp. References connected_, and consumer_.
00218 {
00219 this->consumer_ =
00220 CosEventComm::PullConsumer::_nil ();
00221 this->connected_ = 0;
00222 }
|
|
|
Definition at line 247 of file CEC_ProxyPullSupplier.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_GUARD_THROW_EX, ACE_THROW, and TAO_CEC_Unlock.
00252 {
00253 {
00254 ACE_GUARD_THROW_EX (
00255 ACE_Lock, ace_mon, *this->lock_,
00256 CORBA::INTERNAL ());
00257 // @@ CosEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00258 ACE_CHECK;
00259
00260 if (this->is_connected_i ())
00261 {
00262 if (this->event_channel_->consumer_reconnect () == 0)
00263 ACE_THROW (CosEventChannelAdmin::AlreadyConnected ());
00264
00265 // Re-connections are allowed....
00266 this->cleanup_i ();
00267
00268 this->consumer_ =
00269 CosEventComm::PullConsumer::_duplicate (pull_consumer);
00270 this->connected_ = 1;
00271
00272 TAO_CEC_Unlock reverse_lock (*this->lock_);
00273
00274 {
00275 ACE_GUARD_THROW_EX (
00276 TAO_CEC_Unlock, ace_mon, reverse_lock,
00277 CORBA::INTERNAL ());
00278 // @@ CosEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00279 ACE_CHECK;
00280
00281 this->event_channel_->reconnected (this ACE_ENV_ARG_PARAMETER);
00282 ACE_CHECK;
00283 }
00284 return;
00285 }
00286
00287 this->consumer_ =
00288 CosEventComm::PullConsumer::_duplicate (pull_consumer);
00289 this->connected_ = 1;
00290 }
00291
00292 // Notify the event channel...
00293 this->event_channel_->connected (this ACE_ENV_ARG_PARAMETER);
00294 }
|
|
|
Set the consumer, used by some implementations to change the policies used when invoking operations on the consumer. Definition at line 36 of file CEC_ProxyPullSupplier.i. References ACE_GUARD, and consumer_i().
00037 {
00038 ACE_GUARD (ACE_Lock, ace_mon, *this->lock_);
00039
00040 this->consumer_i (consumer);
00041 }
|
|
|
Return the consumer object reference. It returns nil() if it has not connected yet. NOTE: This method does not return a new reference!!! Doing so will increase the locking overhead on the critical path. Definition at line 22 of file CEC_ProxyPullSupplier.i. References ACE_GUARD_RETURN, and consumer_. Referenced by consumer_non_existent(), and shutdown().
00023 {
00024 ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00025
00026 return this->consumer_.in ();
00027 }
|
|
|
Definition at line 30 of file CEC_ProxyPullSupplier.i. References consumer_. Referenced by consumer().
00031 {
00032 this->consumer_ = consumer;
00033 }
|
|
|
Invoke the _non_existent() pseudo-operation on the consumer. If it is disconnected then it returns true and sets the flag. Definition at line 124 of file CEC_ProxyPullSupplier.cpp. References CORBA::Object::_duplicate(), ACE_CHECK_RETURN, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_GUARD_THROW_EX, consumer(), is_connected_i(), and CORBA::is_nil().
00127 {
00128 CORBA::Object_var consumer;
00129 {
00130 ACE_GUARD_THROW_EX (
00131 ACE_Lock, ace_mon, *this->lock_,
00132 CORBA::INTERNAL ());
00133 ACE_CHECK_RETURN (0);
00134
00135 disconnected = 0;
00136 if (this->is_connected_i () == 0)
00137 {
00138 disconnected = 1;
00139 return 0;
00140 }
00141 if (CORBA::is_nil (this->consumer_.in ()))
00142 {
00143 return 0;
00144 }
00145 consumer = CORBA::Object::_duplicate (this->consumer_.in ());
00146 }
00147
00148 #if (TAO_HAS_MINIMUM_CORBA == 0)
00149 return consumer->_non_existent (ACE_ENV_SINGLE_ARG_PARAMETER);
00150 #else
00151 return 0;
00152 #endif /* TAO_HAS_MINIMUM_CORBA */
00153 }
|
|
|
Deactivate from the POA.
Definition at line 63 of file CEC_ProxyPullSupplier.cpp. References ACE_CATCHANY, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_TRY, and ACE_TRY_CHECK. Referenced by shutdown().
00065 {
00066 ACE_TRY
00067 {
00068 PortableServer::POA_var poa =
00069 this->_default_POA (ACE_ENV_SINGLE_ARG_PARAMETER);
00070 ACE_TRY_CHECK;
00071 PortableServer::ObjectId_var id =
00072 poa->servant_to_id (this ACE_ENV_ARG_PARAMETER);
00073 ACE_TRY_CHECK;
00074 poa->deactivate_object (id.in () ACE_ENV_ARG_PARAMETER);
00075 ACE_TRY_CHECK;
00076 }
00077 ACE_CATCHANY
00078 {
00079 // Exceptions here should not be propagated. They usually
00080 // indicate that an object is beign disconnected twice, or some
00081 // race condition, but not a fault that the user needs to know
00082 // about.
00083 }
00084 ACE_ENDTRY;
00085 }
|
|
|
Definition at line 297 of file CEC_ProxyPullSupplier.cpp. References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_CHECK, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_GUARD_THROW_EX, ACE_PRINT_EXCEPTION, ACE_THROW, ACE_TRY, ACE_TRY_CHECK, and CORBA::is_nil().
00300 {
00301 CosEventComm::PullConsumer_var consumer;
00302
00303 {
00304 ACE_GUARD_THROW_EX (
00305 ACE_Lock, ace_mon, *this->lock_,
00306 CORBA::INTERNAL ());
00307 // @@ CosEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00308 ACE_CHECK;
00309
00310 if (this->is_connected_i () == 0)
00311 ACE_THROW (CORBA::BAD_INV_ORDER ());
00312
00313 consumer = this->consumer_._retn ();
00314
00315 this->cleanup_i ();
00316 }
00317
00318 // Notify the event channel....
00319 this->event_channel_->disconnected (this ACE_ENV_ARG_PARAMETER);
00320 ACE_CHECK;
00321
00322 if (CORBA::is_nil (consumer.in ()))
00323 return;
00324
00325 if (this->event_channel_->disconnect_callbacks ())
00326 {
00327 ACE_TRY
00328 {
00329 consumer->disconnect_pull_consumer (ACE_ENV_SINGLE_ARG_PARAMETER);
00330 ACE_TRY_CHECK;
00331 }
00332 ACE_CATCHANY
00333 {
00334 // Ignore exceptions, we must isolate other clients from
00335 // problems on this one.
00336 ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
00337 "ProxySupplier::disconnect_pull_supplier");
00338 }
00339 ACE_ENDTRY;
00340 }
00341 }
|
|
|
Return 0 if no consumer is connected...
Definition at line 14 of file CEC_ProxyPullSupplier.i. References ACE_GUARD_RETURN, and is_connected_i(). Referenced by push().
00015 {
00016 ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00017
00018 return this->is_connected_i ();
00019 }
|
|
|
The private version (without locking) of is_connected().
Definition at line 8 of file CEC_ProxyPullSupplier.i. References connected_. Referenced by consumer_non_existent(), and is_connected().
00009 {
00010 return this->connected_;
00011 }
|
|
|
Definition at line 171 of file CEC_ProxyPullSupplier.cpp. References ACE_GUARD_RETURN, ACE_THROW_RETURN, and TAO_SYNCH_MUTEX.
00174 {
00175 if (this->is_connected () == 0)
00176 ACE_THROW_RETURN (CosEventComm::Disconnected (), 0);
00177
00178 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, queue_lock_, 0);
00179 while (this->queue_.is_empty ())
00180 {
00181 this->wait_not_empty_.wait ();
00182 }
00183 CORBA::Any any;
00184 if (this->queue_.dequeue_head (any) != 0)
00185 {
00186 ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
00187 }
00188 return new CORBA::Any (any);
00189 }
|
|
|
Push an event into the queue.
Definition at line 156 of file CEC_ProxyPullSupplier.cpp. References ACE_GUARD, is_connected(), TAO_SYNCH_MUTEX, and wait_not_empty_.
00158 {
00159 if (this->is_connected () == 0)
00160 return;
00161
00162 ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->queue_lock_);
00163
00164 // Ignore errors
00165 (void) this->queue_.enqueue_tail (event);
00166
00167 this->wait_not_empty_.signal ();
00168 }
|
|
|
The event channel is shutting down.
Definition at line 88 of file CEC_ProxyPullSupplier.cpp. References ACE_CATCHANY, ACE_CHECK, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_GUARD_THROW_EX, ACE_TRY, ACE_TRY_CHECK, consumer(), consumer_, deactivate(), and CORBA::is_nil().
00089 {
00090 // Save the consumer we where connected to, we need to send a
00091 // disconnect message to it.
00092 CosEventComm::PullConsumer_var consumer;
00093
00094 {
00095 ACE_GUARD_THROW_EX (
00096 ACE_Lock, ace_mon, *this->lock_,
00097 CORBA::INTERNAL ());
00098 // @@ CosEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00099 ACE_CHECK;
00100
00101 consumer = this->consumer_._retn ();
00102 }
00103
00104 this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER);
00105 ACE_CHECK;
00106
00107 if (CORBA::is_nil (consumer.in ()))
00108 return;
00109
00110 ACE_TRY
00111 {
00112 consumer->disconnect_pull_consumer (ACE_ENV_SINGLE_ARG_PARAMETER);
00113 ACE_TRY_CHECK;
00114 }
00115 ACE_CATCHANY
00116 {
00117 // Ignore exceptions, we must isolate other clients from
00118 // problems on this one.
00119 }
00120 ACE_ENDTRY;
00121 }
|
|
|
Definition at line 192 of file CEC_ProxyPullSupplier.cpp. References ACE_GUARD_RETURN, ACE_THROW_RETURN, CORBA::Long, and TAO_SYNCH_MUTEX.
00195 {
00196 has_event = 0;
00197 if (this->is_connected () == 0)
00198 ACE_THROW_RETURN (CosEventComm::Disconnected (), 0);
00199
00200 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, queue_lock_, 0);
00201 CORBA::Any any;
00202 if (this->queue_.is_empty ())
00203 {
00204 any <<= CORBA::Long(0);
00205 return new CORBA::Any (any);
00206 }
00207
00208 if (this->queue_.dequeue_head (any) != 0)
00209 {
00210 ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
00211 }
00212 has_event = 1;
00213 return new CORBA::Any (any);
00214 }
|
|
|
If the flag is not zero then we are connected, notice that the consumer can be nil. Definition at line 151 of file CEC_ProxyPullSupplier.h. Referenced by cleanup_i(), and is_connected_i(). |
|
|
The consumer....
Definition at line 147 of file CEC_ProxyPullSupplier.h. Referenced by cleanup_i(), consumer(), consumer_i(), and shutdown(). |
|
|
Store the default POA.
Definition at line 154 of file CEC_ProxyPullSupplier.h. |
|
|
The Event Channel that owns this object.
Definition at line 138 of file CEC_ProxyPullSupplier.h. |
|
|
The locking strategy.
Definition at line 141 of file CEC_ProxyPullSupplier.h. |
|
|
Definition at line 159 of file CEC_ProxyPullSupplier.h. |
|
|
Use a message queue to pass the.
Definition at line 157 of file CEC_ProxyPullSupplier.h. |
|
|
The reference count.
Definition at line 144 of file CEC_ProxyPullSupplier.h. |
|
|
Definition at line 158 of file CEC_ProxyPullSupplier.h. Referenced by push(). |
1.3.6