TAO_CEC_ProxyPullConsumer Class Reference

ProxyPullConsumer. More...

#include <CEC_ProxyPullConsumer.h>

Collaboration diagram for TAO_CEC_ProxyPullConsumer:

Collaboration graph
[legend]
List of all members.

Public Types

typedef CosEventChannelAdmin::ProxyPullConsumer_ptr _ptr_type
typedef CosEventChannelAdmin::ProxyPullConsumer_var _var_type

Public Member Functions

 TAO_CEC_ProxyPullConsumer (TAO_CEC_EventChannel *event_channel)
 constructor...

virtual ~TAO_CEC_ProxyPullConsumer (void)
 destructor...

CosEventComm::PullSupplier_ptr supplier (void) const
CORBA::Any * try_pull_from_supplier (CORBA::Boolean_out has_event)
 Pulls from the supplier, verifies that it is connected.

CORBA::Any * pull_from_supplier ()
CORBA::Boolean supplier_non_existent (CORBA::Boolean_out disconnected)
virtual void shutdown ()
 The event channel is shutting down.

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

CORBA::ULong _decr_refcnt (void)
virtual void _add_ref ()
virtual void _remove_ref ()

Public Attributes

virtual void virtual activate(CosEventChannelAdmin::ProxyPullConsumer_ptr
&activated_proxy) ACE_THROW_SPEC((CORBA void deactivate()
ACE_THROW_SPEC((CORBA CORBA::Boolea 
is_connected )(void) const
 Return 0 if no supplier is connected...

virtual void virtual connect_pull_supplier(CosEventComm::PullSupplier_ptr
pull_supplier) ACE_THROW_SPEC((CORBA void virtual disconnect_pull_consumer()
ACE_THROW_SPEC((CORBA PortableServer::POA_pt 
_default_POA )()

Protected Member Functions

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

void cleanup_i (void)
 Release the supplier.


Private Attributes

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

ACE_Locklock_
 The locking strategy.

CORBA::ULong refcount_
 The reference count.

CosEventComm::PullSupplier_var supplier_
 The supplier....

PortableServer::POA_var default_POA_
 Store the default POA.


Detailed Description

ProxyPullConsumer.

Implement the CosEventChannelAdmin::ProxyPullConsumer interface, remember that this class is used to communicate with a PullSupplier, so, in effect, this is the ambassador for a supplier inside the event channel. = MEMORY MANAGMENT The object commits suicide when disconnect_pull_consumer() is called.

Definition at line 46 of file CEC_ProxyPullConsumer.h.


Member Typedef Documentation

typedef CosEventChannelAdmin::ProxyPullConsumer_ptr TAO_CEC_ProxyPullConsumer::_ptr_type
 

Definition at line 49 of file CEC_ProxyPullConsumer.h.

typedef CosEventChannelAdmin::ProxyPullConsumer_var TAO_CEC_ProxyPullConsumer::_var_type
 

Definition at line 50 of file CEC_ProxyPullConsumer.h.


Constructor & Destructor Documentation

TAO_CEC_ProxyPullConsumer::TAO_CEC_ProxyPullConsumer TAO_CEC_EventChannel event_channel  ) 
 

constructor...

Definition at line 24 of file CEC_ProxyPullConsumer.cpp.

References TAO_CEC_EventChannel::consumer_poa(), TAO_CEC_EventChannel::create_consumer_lock(), and TAO_CEC_EventChannel::get_servant_retry_map().

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

TAO_CEC_ProxyPullConsumer::~TAO_CEC_ProxyPullConsumer void   )  [virtual]
 

destructor...

Definition at line 37 of file CEC_ProxyPullConsumer.cpp.

References TAO_CEC_EventChannel::destroy_consumer_lock(), and TAO_CEC_EventChannel::get_servant_retry_map().

00038 {
00039   this->event_channel_->get_servant_retry_map ().unbind (this);
00040   this->event_channel_->destroy_consumer_lock (this->lock_);
00041 }


Member Function Documentation

void TAO_CEC_ProxyPullConsumer::_add_ref  )  [virtual]
 

Definition at line 384 of file CEC_ProxyPullConsumer.cpp.

References _incr_refcnt().

00385 {
00386   this->_incr_refcnt ();
00387 }

CORBA::ULong TAO_CEC_ProxyPullConsumer::_decr_refcnt void   ) 
 

Definition at line 267 of file CEC_ProxyPullConsumer.cpp.

References ACE_GUARD_RETURN, and TAO_CEC_EventChannel::destroy_proxy().

Referenced by _remove_ref().

00268 {
00269   {
00270     ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00271     this->refcount_--;
00272     if (this->refcount_ != 0)
00273       return this->refcount_;
00274   }
00275 
00276   // Notify the event channel
00277   this->event_channel_->destroy_proxy (this);
00278   return 0;
00279 }

CORBA::ULong TAO_CEC_ProxyPullConsumer::_incr_refcnt void   ) 
 

Increment and decrement the reference count.

Definition at line 260 of file CEC_ProxyPullConsumer.cpp.

References ACE_GUARD_RETURN.

Referenced by _add_ref().

00261 {
00262   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00263   return this->refcount_++;
00264 }

void TAO_CEC_ProxyPullConsumer::_remove_ref  )  [virtual]
 

Definition at line 390 of file CEC_ProxyPullConsumer.cpp.

References _decr_refcnt().

00391 {
00392   this->_decr_refcnt ();
00393 }

void TAO_CEC_ProxyPullConsumer::cleanup_i void   )  [protected]
 

Release the supplier.

Definition at line 253 of file CEC_ProxyPullConsumer.cpp.

References supplier_.

00254 {
00255   this->supplier_ =
00256     CosEventComm::PullSupplier::_nil ();
00257 }

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

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

Definition at line 8 of file CEC_ProxyPullConsumer.i.

References CORBA::is_nil().

Referenced by pull_from_supplier(), supplier_non_existent(), and try_pull_from_supplier().

00009 {
00010   return !CORBA::is_nil (this->supplier_.in ());
00011 }

CORBA::Any * TAO_CEC_ProxyPullConsumer::pull_from_supplier  ) 
 

Definition at line 150 of file CEC_ProxyPullConsumer.cpp.

References ACE_CATCHANY, ACE_CHECK_RETURN, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_GUARD_THROW_EX, ACE_TRY, ACE_TRY_CHECK, is_connected_i(), and supplier().

00152 {
00153   CosEventComm::PullSupplier_var supplier;
00154   {
00155     ACE_GUARD_THROW_EX (
00156             ACE_Lock, ace_mon, *this->lock_,
00157             CORBA::INTERNAL ());
00158     // @@ CosEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00159     ACE_CHECK_RETURN (0);
00160 
00161     if (this->is_connected_i () == 0)
00162       return 0; // ACE_THROW (CosEventComm::Disconnected ());????
00163 
00164     supplier =
00165       CosEventComm::PullSupplier::_duplicate (this->supplier_.in ());
00166 
00167     // The refcount cannot be zero, because we have at least two
00168     // references,
00169   }
00170 
00171   CORBA::Any_var any;
00172   ACE_TRY
00173     {
00174       any = supplier->pull (ACE_ENV_SINGLE_ARG_PARAMETER);
00175       ACE_TRY_CHECK;
00176     }
00177   ACE_CATCHANY
00178     {
00179       // @@ This is where the policies for misbehaving suppliers
00180       //    should kick in.... for the moment just ignore them.
00181     }
00182   ACE_ENDTRY;
00183   return any._retn ();
00184 }

void TAO_CEC_ProxyPullConsumer::shutdown  )  [virtual]
 

The event channel is shutting down.

Definition at line 219 of file CEC_ProxyPullConsumer.cpp.

References ACE_CATCHANY, ACE_CHECK, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_GUARD_THROW_EX, ACE_TRY, ACE_TRY_CHECK, CORBA::is_nil(), supplier(), and supplier_.

00220 {
00221   CosEventComm::PullSupplier_var supplier;
00222 
00223   {
00224     ACE_GUARD_THROW_EX (
00225         ACE_Lock, ace_mon, *this->lock_,
00226         CORBA::INTERNAL ());
00227     // @@ CosEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00228     ACE_CHECK;
00229 
00230     supplier = this->supplier_._retn ();
00231   }
00232 
00233   this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER);
00234   ACE_CHECK;
00235 
00236   if (CORBA::is_nil (supplier.in ()))
00237     return;
00238 
00239   ACE_TRY
00240     {
00241       supplier->disconnect_pull_supplier (ACE_ENV_SINGLE_ARG_PARAMETER);
00242       ACE_TRY_CHECK;
00243     }
00244   ACE_CATCHANY
00245     {
00246       // Ignore exceptions, we must isolate other clients from
00247       // failures on this one.
00248     }
00249   ACE_ENDTRY;
00250 }

ACE_INLINE void TAO_CEC_ProxyPullConsumer::supplier CosEventComm::PullSupplier_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 CEC_ProxyPullConsumer.i.

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 CosEventComm::PullSupplier_ptr TAO_CEC_ProxyPullConsumer::supplier void   )  const
 

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

Definition at line 22 of file CEC_ProxyPullConsumer.i.

References ACE_GUARD_RETURN.

Referenced by pull_from_supplier(), shutdown(), supplier_non_existent(), and try_pull_from_supplier().

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

ACE_INLINE void TAO_CEC_ProxyPullConsumer::supplier_i CosEventComm::PullSupplier_ptr  supplier  )  [protected]
 

Definition at line 29 of file CEC_ProxyPullConsumer.i.

References supplier_.

Referenced by supplier().

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

CORBA::Boolean TAO_CEC_ProxyPullConsumer::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 187 of file CEC_ProxyPullConsumer.cpp.

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

00190 {
00191   CORBA::Object_var supplier;
00192   {
00193     ACE_GUARD_THROW_EX (
00194         ACE_Lock, ace_mon, *this->lock_,
00195         CORBA::INTERNAL ());
00196     ACE_CHECK_RETURN (0);
00197 
00198     disconnected = 0;
00199     if (this->is_connected_i () == 0)
00200       {
00201         disconnected = 1;
00202         return 0;
00203       }
00204     if (CORBA::is_nil (this->supplier_.in ()))
00205       {
00206         return 0;
00207       }
00208     supplier = CORBA::Object::_duplicate (this->supplier_.in ());
00209   }
00210 
00211 #if (TAO_HAS_MINIMUM_CORBA == 0)
00212   return supplier->_non_existent (ACE_ENV_SINGLE_ARG_PARAMETER);
00213 #else
00214   return 0;
00215 #endif /* TAO_HAS_MINIMUM_CORBA */
00216 }

CORBA::Any * TAO_CEC_ProxyPullConsumer::try_pull_from_supplier CORBA::Boolean_out  has_event  ) 
 

Pulls from the supplier, verifies that it is connected.

Definition at line 94 of file CEC_ProxyPullConsumer.cpp.

References ACE_CATCH, ACE_CATCHANY, ACE_CHECK_RETURN, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_GUARD_THROW_EX, ACE_TRY, ACE_TRY_CHECK, is_connected_i(), TAO_CEC_SupplierControl::successful_transmission(), supplier(), TAO_CEC_EventChannel::supplier_control(), TAO_CEC_SupplierControl::supplier_not_exist(), and TAO_CEC_SupplierControl::system_exception().

00097 {
00098   has_event = 0;
00099   CosEventComm::PullSupplier_var supplier;
00100   {
00101     ACE_GUARD_THROW_EX (
00102             ACE_Lock, ace_mon, *this->lock_,
00103             CORBA::INTERNAL ());
00104     // @@ CosEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00105     ACE_CHECK_RETURN (0);
00106 
00107     if (this->is_connected_i () == 0)
00108       return 0; // ACE_THROW (CosEventComm::Disconnected ());????
00109 
00110     supplier =
00111       CosEventComm::PullSupplier::_duplicate (this->supplier_.in ());
00112 
00113     // The refcount cannot be zero, because we have at least two
00114     // references,
00115   }
00116 
00117   CORBA::Any_var any;
00118   TAO_CEC_SupplierControl *control =
00119                  this->event_channel_->supplier_control ();
00120 
00121   ACE_TRY
00122     {
00123       any = supplier->try_pull (has_event ACE_ENV_ARG_PARAMETER);
00124       ACE_TRY_CHECK;
00125 
00126       // Inform the control that we got something from the supplier
00127       control->successful_transmission(this);
00128     }
00129   ACE_CATCH (CORBA::OBJECT_NOT_EXIST, ex)
00130     {
00131       control->supplier_not_exist (this ACE_ENV_ARG_PARAMETER);
00132       ACE_TRY_CHECK;
00133     }
00134   ACE_CATCH (CORBA::SystemException, sysex)
00135     {
00136       control->system_exception (this,
00137                                  sysex
00138                                  ACE_ENV_ARG_PARAMETER);
00139       ACE_TRY_CHECK;
00140     }
00141   ACE_CATCHANY
00142     {
00143       // @@ Should not happen
00144     }
00145   ACE_ENDTRY;
00146   return any._retn ();
00147 }


Member Data Documentation

PortableServer::POA_ptr TAO_CEC_ProxyPullConsumer::_default_POA
 

Definition at line 378 of file CEC_ProxyPullConsumer.cpp.

00379 {
00380   return PortableServer::POA::_duplicate (this->default_POA_.in ());
00381 }

PortableServer::POA_var TAO_CEC_ProxyPullConsumer::default_POA_ [private]
 

Store the default POA.

Definition at line 135 of file CEC_ProxyPullConsumer.h.

TAO_CEC_EventChannel* TAO_CEC_ProxyPullConsumer::event_channel_ [private]
 

The supplier admin, used for activation and memory managment.

Definition at line 123 of file CEC_ProxyPullConsumer.h.

ACE_INLINE CORBA::Boolean TAO_CEC_ProxyPullConsumer::is_connected
 

Return 0 if no supplier is connected...

Definition at line 14 of file CEC_ProxyPullConsumer.i.

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

ACE_Lock* TAO_CEC_ProxyPullConsumer::lock_ [private]
 

The locking strategy.

Definition at line 126 of file CEC_ProxyPullConsumer.h.

CORBA::ULong TAO_CEC_ProxyPullConsumer::refcount_ [private]
 

The reference count.

Definition at line 129 of file CEC_ProxyPullConsumer.h.

CosEventComm::PullSupplier_var TAO_CEC_ProxyPullConsumer::supplier_ [private]
 

The supplier....

Definition at line 132 of file CEC_ProxyPullConsumer.h.

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


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:19:37 2006 for TAO_CosEvent by doxygen 1.3.6