TAO_CEC_ProxyPushSupplier Class Reference

ProxyPushSupplier. More...

#include <CEC_ProxyPushSupplier.h>

Collaboration diagram for TAO_CEC_ProxyPushSupplier:

Collaboration graph
[legend]
List of all members.

Public Types

typedef CosEventChannelAdmin::ProxyPushSupplier_ptr _ptr_type
typedef CosEventChannelAdmin::ProxyPushSupplier_var _var_type

Public Member Functions

 TAO_CEC_ProxyPushSupplier (TAO_CEC_EventChannel *event_channel, const ACE_Time_Value &timeout)
 constructor...
virtual ~TAO_CEC_ProxyPushSupplier (void)
 destructor...
virtual void activate (CosEventChannelAdmin::ProxyPushSupplier_ptr &)
 Activate in the POA.
virtual void deactivate (void)
 Deactivate from the POA.
CORBA::Boolean is_connected (void) const
 Return 0 if no consumer is connected...
CosEventComm::PushConsumer_ptr consumer (void) const
virtual void shutdown (void)
 The event channel is shutting down.
virtual void push (const CORBA::Any &event)
 Internal methods to push an event to each consumer.
virtual void push_nocopy (CORBA::Any &event)
void push_to_consumer (const CORBA::Any &event)
 Pushes to the consumer, verifies that it is connected.
void reactive_push_to_consumer (const CORBA::Any &event)
CORBA::Boolean consumer_non_existent (CORBA::Boolean_out disconnected)
virtual void connect_push_consumer (CosEventComm::PushConsumer_ptr push_consumer)
virtual void disconnect_push_supplier (void)
CORBA::ULong _incr_refcnt (void)
 Increment and decrement the reference count.
CORBA::ULong _decr_refcnt (void)
virtual PortableServer::POA_ptr _default_POA (void)
virtual void _add_ref (void)
virtual void _remove_ref (void)

Protected Member Functions

void consumer (CosEventComm::PushConsumer_ptr consumer)
void consumer_i (CosEventComm::PushConsumer_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.
CosEventComm::PushConsumer_ptr apply_policy (CosEventComm::PushConsumer_ptr c)
CORBA::Object_ptr apply_policy_obj (CORBA::Object_ptr c)

Private Attributes

TAO_CEC_EventChannelevent_channel_
 The Event Channel that owns this object.
ACE_Time_Value timeout_
ACE_Locklock_
 The locking strategy.
CORBA::ULong refcount_
 The reference count.
CosEventComm::PushConsumer_var consumer_
CosEventComm::PushConsumer_var nopolicy_consumer_
 The consumer without any policies applied.
PortableServer::POA_var default_POA_
 Store the default POA.

Detailed Description

ProxyPushSupplier.

Implement the CosEventChannelAdmin::ProxyPushSupplier interface, remember that this class is used to communicate with a PushConsumer, 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 58 of file CEC_ProxyPushSupplier.h.


Member Typedef Documentation

typedef CosEventChannelAdmin::ProxyPushSupplier_ptr TAO_CEC_ProxyPushSupplier::_ptr_type

Definition at line 61 of file CEC_ProxyPushSupplier.h.

typedef CosEventChannelAdmin::ProxyPushSupplier_var TAO_CEC_ProxyPushSupplier::_var_type

Definition at line 62 of file CEC_ProxyPushSupplier.h.


Constructor & Destructor Documentation

TAO_CEC_ProxyPushSupplier::TAO_CEC_ProxyPushSupplier ( TAO_CEC_EventChannel event_channel,
const ACE_Time_Value timeout 
)

constructor...

Definition at line 39 of file CEC_ProxyPushSupplier.cpp.

00041   : event_channel_ (ec),
00042     timeout_ (timeout),
00043     refcount_ (1)
00044 {
00045 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00046   typed_event_channel_ = 0;
00047 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00048 
00049   this->lock_ =
00050     this->event_channel_->create_supplier_lock ();
00051 
00052   this->default_POA_ =
00053     this->event_channel_->supplier_poa ();
00054 
00055   this->event_channel_->get_servant_retry_map ().bind (this, 0);
00056 }

TAO_CEC_ProxyPushSupplier::~TAO_CEC_ProxyPushSupplier ( void   )  [virtual]

destructor...

Definition at line 79 of file CEC_ProxyPushSupplier.cpp.

References TAO_CEC_EventChannel::destroy_supplier_lock(), event_channel_, and TAO_CEC_EventChannel::get_servant_retry_map().

00080 {
00081 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00082   if (this->is_typed_ec () )
00083     {
00084       this->typed_event_channel_->get_servant_retry_map ().unbind (this);
00085       this->typed_event_channel_->destroy_supplier_lock (this->lock_);
00086     }
00087   else
00088     {
00089       this->event_channel_->get_servant_retry_map ().unbind (this);
00090       this->event_channel_->destroy_supplier_lock (this->lock_);
00091     }
00092 #else
00093   this->event_channel_->get_servant_retry_map ().unbind (this);
00094   this->event_channel_->destroy_supplier_lock (this->lock_);
00095 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00096 }


Member Function Documentation

void TAO_CEC_ProxyPushSupplier::_add_ref ( void   )  [virtual]

Definition at line 890 of file CEC_ProxyPushSupplier.cpp.

References _incr_refcnt().

00891 {
00892   this->_incr_refcnt ();
00893 }

CORBA::ULong TAO_CEC_ProxyPushSupplier::_decr_refcnt ( void   ) 

Definition at line 303 of file CEC_ProxyPushSupplier.cpp.

References ACE_GUARD_RETURN, TAO_CEC_EventChannel::destroy_proxy(), event_channel_, and refcount_.

Referenced by _remove_ref(), and TAO_CEC_Push_Command::~TAO_CEC_Push_Command().

00304 {
00305   {
00306     ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00307     --this->refcount_;
00308     if (this->refcount_ != 0)
00309       return this->refcount_;
00310   }
00311 
00312   // Notify the event channel
00313 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00314   if (this->is_typed_ec () )
00315     {
00316       this->typed_event_channel_->destroy_proxy (this);
00317     }
00318   else
00319     {
00320       this->event_channel_->destroy_proxy (this);
00321     }
00322 #else
00323   this->event_channel_->destroy_proxy (this);
00324 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00325   return 0;
00326 }

PortableServer::POA_ptr TAO_CEC_ProxyPushSupplier::_default_POA ( void   )  [virtual]

Definition at line 884 of file CEC_ProxyPushSupplier.cpp.

Referenced by deactivate().

00885 {
00886   return PortableServer::POA::_duplicate (this->default_POA_.in ());
00887 }

CORBA::ULong TAO_CEC_ProxyPushSupplier::_incr_refcnt ( void   ) 

Increment and decrement the reference count.

Definition at line 296 of file CEC_ProxyPushSupplier.cpp.

References ACE_GUARD_RETURN, and refcount_.

Referenced by _add_ref(), and TAO_CEC_Push_Command::TAO_CEC_Push_Command().

00297 {
00298   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00299   return this->refcount_++;
00300 }

void TAO_CEC_ProxyPushSupplier::_remove_ref ( void   )  [virtual]

Definition at line 896 of file CEC_ProxyPushSupplier.cpp.

References _decr_refcnt().

00897 {
00898   this->_decr_refcnt ();
00899 }

void TAO_CEC_ProxyPushSupplier::activate ( CosEventChannelAdmin::ProxyPushSupplier_ptr &   )  [virtual]

Activate in the POA.

Definition at line 99 of file CEC_ProxyPushSupplier.cpp.

00101 {
00102   CosEventChannelAdmin::ProxyPushSupplier_var result;
00103   try
00104     {
00105       result = this->_this ();
00106     }
00107   catch (const CORBA::Exception&)
00108     {
00109       result = CosEventChannelAdmin::ProxyPushSupplier::_nil ();
00110     }
00111   activated_proxy = result._retn ();
00112 }

CosEventComm::PushConsumer_ptr TAO_CEC_ProxyPushSupplier::apply_policy ( CosEventComm::PushConsumer_ptr  c  )  [protected]

Assigns the parameter to both consumer_ and nopolicy_consumer_, and applies policies (when appropriate) to consumer_.

Definition at line 485 of file CEC_ProxyPushSupplier.cpp.

References apply_policy_obj(), TAO_Pseudo_Var_T< T >::in(), and nopolicy_consumer_.

Referenced by connect_push_consumer().

00486 {
00487   this->nopolicy_consumer_ = CosEventComm::PushConsumer::_duplicate (pre);
00488   CORBA::Object_var post_obj = apply_policy_obj (pre);
00489   CosEventComm::PushConsumer_var post =
00490     CosEventComm::PushConsumer::_narrow (post_obj.in ());
00491   return post._retn ();
00492 }

CORBA::Object_ptr TAO_CEC_ProxyPushSupplier::apply_policy_obj ( CORBA::Object_ptr  c  )  [protected]

Definition at line 455 of file CEC_ProxyPushSupplier.cpp.

References CORBA::Object::_duplicate(), TAO_Pseudo_Var_T< T >::_retn(), CORBA::Object::_set_policy_overrides(), event_channel_, and ACE_Time_Value::zero.

Referenced by apply_policy(), and connect_push_consumer().

00456 {
00457 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
00458   CORBA::Object_var post = CORBA::Object::_duplicate (pre);
00459   if (this->timeout_ > ACE_Time_Value::zero)
00460     {
00461       CORBA::PolicyList policy_list;
00462       policy_list.length (1);
00463       if (this->typed_event_channel_)
00464         {
00465           policy_list[0] = this->typed_event_channel_->
00466             create_roundtrip_timeout_policy (this->timeout_);
00467         }
00468       else
00469         {
00470           policy_list[0] = this->event_channel_->
00471             create_roundtrip_timeout_policy (this->timeout_);
00472         }
00473       post = pre->_set_policy_overrides (policy_list, CORBA::ADD_OVERRIDE);
00474 
00475       policy_list[0]->destroy ();
00476       policy_list.length (0);
00477     }
00478   return post._retn ();
00479 #else
00480   return CORBA::Object::_duplicate (pre);
00481 #endif /* TAO_HAS_CORBA_MESSAGING */
00482 }

void TAO_CEC_ProxyPushSupplier::cleanup_i ( void   )  [protected]

Release the child and the consumer.

Definition at line 285 of file CEC_ProxyPushSupplier.cpp.

References consumer_.

Referenced by connect_push_consumer(), and disconnect_push_supplier().

00286 {
00287   this->consumer_ =
00288     CosEventComm::PushConsumer::_nil ();
00289 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00290   this->typed_consumer_ =
00291     CosTypedEventComm::TypedPushConsumer::_nil ();
00292 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00293 }

void TAO_CEC_ProxyPushSupplier::connect_push_consumer ( CosEventComm::PushConsumer_ptr  push_consumer  )  [virtual]

Definition at line 329 of file CEC_ProxyPushSupplier.cpp.

References CORBA::Object::_duplicate(), ACE_DEBUG, ACE_GUARD_THROW_EX, ACE_TEXT(), apply_policy(), apply_policy_obj(), cleanup_i(), TAO_CEC_EventChannel::connected(), consumer_, event_channel_, TAO_Pseudo_Var_T< T >::in(), CORBA::is_nil(), LM_DEBUG, TAO_CEC_EventChannel::reconnected(), TAO_CEC_Unlock, and TAO_debug_level.

00331 {
00332   // Nil PushConsumers are illegal
00333   if (CORBA::is_nil (push_consumer))
00334     throw CORBA::BAD_PARAM ();
00335 
00336   {
00337 
00338 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00339     // Check if we have a typed event channel
00340     if (this->is_typed_ec () )
00341       {
00342         if (TAO_debug_level >= 10)
00343           {
00344             ACE_DEBUG ((LM_DEBUG,
00345                         ACE_TEXT ("***** connect_push_consumer, ")
00346                         ACE_TEXT ("Event channel is typed *****\n")));
00347           }
00348 
00349         // Temporary for the TypedPushConsumer and it's Typed interface,
00350         // declared and obtained before the Guard to avoid deadlock during the
00351         // _is_a (during _narrow) and get_typed_consumer invocations.
00352         // They are eventually assigned onto this object inside the Guard.
00353         CosTypedEventComm::TypedPushConsumer_var local_typed_consumer =
00354           CosTypedEventComm::TypedPushConsumer::_narrow (push_consumer);
00355 
00356         // Obtain the typed object interface from the consumer
00357         CORBA::Object_var local_typed_consumer_obj =
00358           CORBA::Object::_duplicate (local_typed_consumer->get_typed_consumer () );
00359 
00360         {
00361           ACE_GUARD_THROW_EX (
00362               ACE_Lock, ace_mon, *this->lock_,
00363               CORBA::INTERNAL ());
00364           // @@ CosEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00365 
00366           if (this->is_connected_i ())
00367             {
00368               if (this->typed_event_channel_->consumer_reconnect () == 0)
00369                 throw CosEventChannelAdmin::AlreadyConnected ();
00370 
00371               // Re-connections are allowed....
00372               this->cleanup_i ();
00373 
00374               this->typed_consumer_ = apply_policy (local_typed_consumer.in () );
00375 
00376               TAO_CEC_Unlock reverse_lock (*this->lock_);
00377 
00378               {
00379                 ACE_GUARD_THROW_EX (
00380                     TAO_CEC_Unlock, ace_mon, reverse_lock,
00381                     CORBA::INTERNAL ());
00382                 // @@ CosEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00383 
00384                 this->typed_event_channel_->reconnected (this);
00385               }
00386               return;
00387 
00388             }
00389 
00390           this->typed_consumer_ = apply_policy (local_typed_consumer.in () );
00391 
00392           // Store the typed object interface from the consumer
00393           this->typed_consumer_obj_ =
00394             apply_policy_obj (local_typed_consumer_obj.in () );
00395         }
00396 
00397         // Notify the event channel...
00398         this->typed_event_channel_->connected (this);
00399 
00400       } /* this->is_typed_ec */
00401     else
00402       {
00403 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00404 
00405         if (TAO_debug_level >= 10)
00406           {
00407             ACE_DEBUG ((LM_DEBUG,
00408                         ACE_TEXT ("***** connect_push_consumer, ")
00409                         ACE_TEXT ("Event channel is un-typed *****\n")));
00410           }
00411 
00412         {
00413 
00414     ACE_GUARD_THROW_EX (
00415         ACE_Lock, ace_mon, *this->lock_,
00416         CORBA::INTERNAL ());
00417     // @@ CosEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00418 
00419     if (this->is_connected_i ())
00420       {
00421         if (this->event_channel_->consumer_reconnect () == 0)
00422           throw CosEventChannelAdmin::AlreadyConnected ();
00423 
00424         // Re-connections are allowed....
00425         this->cleanup_i ();
00426 
00427         this->consumer_ = apply_policy (push_consumer);
00428 
00429         TAO_CEC_Unlock reverse_lock (*this->lock_);
00430 
00431         {
00432           ACE_GUARD_THROW_EX (
00433               TAO_CEC_Unlock, ace_mon, reverse_lock,
00434               CORBA::INTERNAL ());
00435           // @@ CosEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00436 
00437           this->event_channel_->reconnected (this);
00438         }
00439         return;
00440       }
00441 
00442     this->consumer_ = apply_policy (push_consumer);
00443   }
00444 
00445   // Notify the event channel...
00446   this->event_channel_->connected (this);
00447 
00448 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00449       } /* ! this->is_typed_ec */
00450 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00451   }
00452 }

ACE_INLINE void TAO_CEC_ProxyPushSupplier::consumer ( CosEventComm::PushConsumer_ptr  consumer  )  [protected]

Set the consumer, used by some implementations to change the policies used when invoking operations on the consumer.

Definition at line 66 of file CEC_ProxyPushSupplier.inl.

References ACE_GUARD, and consumer_i().

00067 {
00068   ACE_GUARD (ACE_Lock, ace_mon, *this->lock_);
00069 
00070   this->consumer_i (consumer);
00071 }

ACE_INLINE CosEventComm::PushConsumer_ptr TAO_CEC_ProxyPushSupplier::consumer ( void   )  const

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 33 of file CEC_ProxyPushSupplier.inl.

References ACE_GUARD_RETURN, and consumer_.

Referenced by consumer_non_existent(), disconnect_push_supplier(), push_to_consumer(), reactive_push_to_consumer(), and shutdown().

00034 {
00035   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00036 
00037 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00038   if (this->is_typed_ec ())
00039   {
00040     return this->typed_consumer_.in ();
00041   }
00042   else
00043   {
00044     return this->consumer_.in ();
00045   }
00046 #else
00047   return this->consumer_.in ();
00048 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00049 }

ACE_INLINE void TAO_CEC_ProxyPushSupplier::consumer_i ( CosEventComm::PushConsumer_ptr  consumer  )  [protected]

Definition at line 52 of file CEC_ProxyPushSupplier.inl.

References consumer_.

Referenced by consumer().

00053 {
00054   this->consumer_ = consumer;
00055 }

CORBA::Boolean TAO_CEC_ProxyPushSupplier::consumer_non_existent ( CORBA::Boolean_out  disconnected  ) 

Invoke the _non_existent() pseudo-operation on the consumer. If it is disconnected then it returns true and sets the <disconnected> flag.

Definition at line 837 of file CEC_ProxyPushSupplier.cpp.

References CORBA::Object::_duplicate(), ACE_GUARD_THROW_EX, and consumer().

Referenced by TAO_CEC_Ping_Push_Consumer::work().

00839 {
00840   CORBA::Object_var consumer;
00841   {
00842     ACE_GUARD_THROW_EX (
00843         ACE_Lock, ace_mon, *this->lock_,
00844         CORBA::INTERNAL ());
00845 
00846     disconnected = 0;
00847     if (this->is_connected_i () == 0)
00848       {
00849         disconnected = 1;
00850         return 0;
00851       }
00852 
00853 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00854     if (this->is_typed_ec () )
00855       {
00856         if (CORBA::is_nil (this->nopolicy_typed_consumer_.in ()))
00857           {
00858             return 0;
00859           }
00860         consumer = CORBA::Object::_duplicate
00861           (this->nopolicy_typed_consumer_.in ());
00862       }
00863     else
00864       {
00865 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00866     if (CORBA::is_nil (this->nopolicy_consumer_.in ()))
00867       {
00868         return 0;
00869       }
00870     consumer = CORBA::Object::_duplicate (this->nopolicy_consumer_.in ());
00871 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00872       } /* ! this->is_typed_ec */
00873 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00874   }
00875 
00876 #if (TAO_HAS_MINIMUM_CORBA == 0)
00877   return consumer->_non_existent ();
00878 #else
00879   return 0;
00880 #endif /* TAO_HAS_MINIMUM_CORBA */
00881 }

void TAO_CEC_ProxyPushSupplier::deactivate ( void   )  [virtual]

Deactivate from the POA.

Definition at line 115 of file CEC_ProxyPushSupplier.cpp.

References _default_POA().

Referenced by shutdown().

00116 {
00117   try
00118     {
00119       PortableServer::POA_var poa =
00120         this->_default_POA ();
00121       PortableServer::ObjectId_var id =
00122         poa->servant_to_id (this);
00123       poa->deactivate_object (id.in ());
00124     }
00125   catch (const CORBA::Exception&)
00126     {
00127       // Exceptions here should not be propagated.  They usually
00128       // indicate that an object is beign disconnected twice, or some
00129       // race condition, but not a fault that the user needs to know
00130       // about.
00131     }
00132 }

void TAO_CEC_ProxyPushSupplier::disconnect_push_supplier ( void   )  [virtual]

Definition at line 509 of file CEC_ProxyPushSupplier.cpp.

References CORBA::Exception::_tao_print_exception(), ACE_GUARD_THROW_EX, cleanup_i(), consumer(), consumer_, TAO_CEC_EventChannel::disconnected(), and event_channel_.

Referenced by TAO_CEC_Reactive_ConsumerControl::consumer_not_exist(), and TAO_CEC_Reactive_ConsumerControl::system_exception().

00510 {
00511   CosEventComm::PushConsumer_var consumer;
00512 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00513   CosTypedEventComm::TypedPushConsumer_var typed_consumer;
00514 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00515 
00516   {
00517     ACE_GUARD_THROW_EX (
00518         ACE_Lock, ace_mon, *this->lock_,
00519         CORBA::INTERNAL ());
00520     // @@ CosEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00521 
00522     if (this->is_connected_i () == 0)
00523       throw CORBA::BAD_INV_ORDER ();
00524 
00525 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00526     if (this->is_typed_ec () )
00527       {
00528         typed_consumer = this->typed_consumer_._retn ();
00529       }
00530     else
00531       {
00532         consumer = this->consumer_._retn ();
00533       }
00534 #else
00535     consumer = this->consumer_._retn ();
00536 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00537 
00538     this->cleanup_i ();
00539   }
00540 
00541   // Notify the event channel....
00542 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00543   if (this->is_typed_ec () )
00544     {
00545       this->typed_event_channel_->disconnected (this);
00546     }
00547   else
00548     {
00549       this->event_channel_->disconnected (this);
00550     }
00551 #else
00552   this->event_channel_->disconnected (this);
00553 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00554 
00555   // Disconnect callbacks
00556 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00557   if (this->is_typed_ec () )
00558     {
00559       if (this->typed_event_channel_->disconnect_callbacks ())
00560         {
00561           try
00562             {
00563               typed_consumer->disconnect_push_consumer ();
00564             }
00565           catch (const CORBA::Exception& ex)
00566             {
00567               // Ignore exceptions, we must isolate other clients from
00568               // problems on this one.
00569               ex._tao_print_exception (
00570                 "ProxySupplier::disconnect_push_supplier");
00571             }
00572         }
00573     } /* this->is_typed_ec */
00574   else
00575     {
00576 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00577 
00578   if (this->event_channel_->disconnect_callbacks ())
00579     {
00580       try
00581         {
00582           consumer->disconnect_push_consumer ();
00583         }
00584       catch (const CORBA::Exception& ex)
00585         {
00586           // Ignore exceptions, we must isolate other clients from
00587           // problems on this one.
00588           ex._tao_print_exception ("ProxySupplier::disconnect_push_supplier");
00589         }
00590     }
00591 
00592 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00593     } /* ! this->is_typed_ec */
00594 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00595 }

ACE_INLINE CORBA::Boolean TAO_CEC_ProxyPushSupplier::is_connected ( void   )  const

Return 0 if no consumer is connected...

Definition at line 25 of file CEC_ProxyPushSupplier.inl.

References ACE_GUARD_RETURN, and is_connected_i().

00026 {
00027   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00028 
00029   return this->is_connected_i ();
00030 }

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

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

Definition at line 8 of file CEC_ProxyPushSupplier.inl.

References CORBA::is_nil().

Referenced by is_connected().

00009 {
00010 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00011   if (this->is_typed_ec ())
00012   {
00013     return !CORBA::is_nil (this->typed_consumer_.in ());
00014   }
00015   else
00016   {
00017   return !CORBA::is_nil (this->consumer_.in ());
00018   }
00019 #else
00020   return !CORBA::is_nil (this->consumer_.in ());
00021 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00022 }

void TAO_CEC_ProxyPushSupplier::push ( const CORBA::Any &  event  )  [virtual]

Internal methods to push an event to each consumer.

Definition at line 206 of file CEC_ProxyPushSupplier.cpp.

References ACE_GUARD, TAO_CEC_EventChannel::dispatching(), event_channel_, TAO_CEC_Dispatching::push(), and TAO_CEC_Unlock.

Referenced by TAO_CEC_Propagate_Event_Push::work().

00207 {
00208   Destroy_Guard auto_destroy (this->refcount_,
00209                               this->event_channel_,
00210                               this);
00211 
00212   {
00213     ACE_GUARD (ACE_Lock, ace_mon, *this->lock_);
00214 
00215     if (this->is_connected_i () == 0)
00216       return;
00217 
00218     TAO_ESF_RefCount_Guard<CORBA::ULong> cnt_mon (this->refcount_);
00219 
00220     {
00221       TAO_CEC_Unlock reverse_lock (*this->lock_);
00222 
00223       ACE_GUARD (TAO_CEC_Unlock, ace_mon, reverse_lock);
00224       this->event_channel_->dispatching ()->push (this,
00225                                                   event);
00226     }
00227   }
00228 }

void TAO_CEC_ProxyPushSupplier::push_nocopy ( CORBA::Any &  event  )  [virtual]

Definition at line 260 of file CEC_ProxyPushSupplier.cpp.

References ACE_GUARD, TAO_CEC_EventChannel::dispatching(), event_channel_, TAO_CEC_Dispatching::push_nocopy(), and TAO_CEC_Unlock.

00261 {
00262   Destroy_Guard auto_destroy (this->refcount_,
00263                               this->event_channel_,
00264                               this);
00265 
00266   {
00267     ACE_GUARD (ACE_Lock, ace_mon, *this->lock_);
00268 
00269     if (this->is_connected_i () == 0)
00270       return;
00271 
00272     TAO_ESF_RefCount_Guard<CORBA::ULong> cnt_mon (this->refcount_);
00273 
00274     {
00275       TAO_CEC_Unlock reverse_lock (*this->lock_);
00276 
00277       ACE_GUARD (TAO_CEC_Unlock, ace_mon, reverse_lock);
00278       this->event_channel_->dispatching ()->push_nocopy (this,
00279                                                          event);
00280     }
00281   }
00282 }

void TAO_CEC_ProxyPushSupplier::push_to_consumer ( const CORBA::Any &  event  ) 

Pushes to the consumer, verifies that it is connected.

Definition at line 598 of file CEC_ProxyPushSupplier.cpp.

References ACE_GUARD_THROW_EX, consumer(), TAO_CEC_EventChannel::consumer_control(), event_channel_, and TAO_CEC_ConsumerControl::successful_transmission().

Referenced by TAO_CEC_Push_Command::execute().

00599 {
00600   CosEventComm::PushConsumer_var consumer;
00601   {
00602     ACE_GUARD_THROW_EX (
00603             ACE_Lock, ace_mon, *this->lock_,
00604             CORBA::INTERNAL ());
00605     // @@ CosEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00606 
00607     if (this->is_connected_i () == 0)
00608       return; // ACE_THROW (CosEventComm::Disconnected ());????
00609 
00610     consumer =
00611       CosEventComm::PushConsumer::_duplicate (this->consumer_.in ());
00612   }
00613 
00614   TAO_CEC_ConsumerControl *control =
00615                this->event_channel_->consumer_control ();
00616   try
00617     {
00618       consumer->push (event);
00619 
00620       // Inform the control that we were able to push something
00621       control->successful_transmission(this);
00622     }
00623   catch (const CORBA::OBJECT_NOT_EXIST&)
00624     {
00625       control->consumer_not_exist (this);
00626     }
00627   catch (CORBA::SystemException& sysex)
00628     {
00629       control->system_exception (this,
00630                                  sysex);
00631     }
00632   catch (const CORBA::Exception&)
00633     {
00634       // Shouldn't happen, but does not hurt
00635     }
00636 }

void TAO_CEC_ProxyPushSupplier::reactive_push_to_consumer ( const CORBA::Any &  event  ) 

Definition at line 639 of file CEC_ProxyPushSupplier.cpp.

References CORBA::Exception::_tao_print_exception(), ACE_GUARD, consumer(), TAO_CEC_EventChannel::consumer_control(), event_channel_, TAO_CEC_ConsumerControl::successful_transmission(), and TAO_debug_level.

Referenced by TAO_CEC_Reactive_Dispatching::push(), and TAO_CEC_Reactive_Dispatching::push_nocopy().

00641 {
00642   CosEventComm::PushConsumer_var consumer;
00643   {
00644     ACE_GUARD (ACE_Lock, ace_mon, *this->lock_);
00645     if (this->is_connected_i () == 0)
00646       return; // TAO_THROW (CosEventComm::Disconnected ());????
00647 
00648     consumer =
00649       CosEventComm::PushConsumer::_duplicate (this->consumer_.in ());
00650   }
00651 
00652   TAO_CEC_ConsumerControl *control =
00653                   this->event_channel_->consumer_control ();
00654 
00655   try
00656     {
00657       consumer->push (event);
00658 
00659       // Inform the control that we were able to push something
00660       control->successful_transmission(this);
00661     }
00662   catch (const CORBA::OBJECT_NOT_EXIST& not_used)
00663     {
00664        if (TAO_debug_level >= 4)
00665         {
00666           not_used._tao_print_exception (
00667             "during TAO_CEC_ProxyPushSupplier::reactive_push_to_consumer");
00668         }
00669      control->consumer_not_exist (this);
00670     }
00671   catch (CORBA::SystemException& sysex)
00672     {
00673       if (TAO_debug_level >= 4)
00674         {
00675           sysex._tao_print_exception (
00676             "during TAO_CEC_ProxyPushSupplier::reactive_push_to_consumer");
00677         }
00678 
00679       control->system_exception (this,
00680                                  sysex);
00681     }
00682   catch (const CORBA::Exception&)
00683     {
00684       // Shouldn't happen, but does not hurt
00685     }
00686 }

void TAO_CEC_ProxyPushSupplier::shutdown ( void   )  [virtual]

The event channel is shutting down.

Definition at line 135 of file CEC_ProxyPushSupplier.cpp.

References ACE_GUARD_THROW_EX, consumer(), consumer_, deactivate(), and CORBA::is_nil().

00136 {
00137 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00138   if (this->is_typed_ec () )
00139     {
00140       // Save the consumer we where connected to, we need to send a
00141       // disconnect message to it.
00142       CosTypedEventComm::TypedPushConsumer_var typed_consumer;
00143       {
00144         ACE_GUARD_THROW_EX (
00145             ACE_Lock, ace_mon, *this->lock_,
00146             CORBA::INTERNAL ());
00147         // @@ CosEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00148 
00149         typed_consumer = this->typed_consumer_._retn ();
00150       }
00151 
00152       this->deactivate ();
00153 
00154       if (CORBA::is_nil (typed_consumer.in ()))
00155         return;
00156 
00157       try
00158         {
00159           typed_consumer->disconnect_push_consumer ();
00160         }
00161       catch (const CORBA::Exception&)
00162         {
00163           // Ignore exceptions, we must isolate other clients from
00164           // problems on this one.
00165         }
00166     } /* this->is_typed_ec */
00167   else
00168     {
00169 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00170 
00171   // Save the consumer we where connected to, we need to send a
00172   // disconnect message to it.
00173   CosEventComm::PushConsumer_var consumer;
00174 
00175   {
00176     ACE_GUARD_THROW_EX (
00177         ACE_Lock, ace_mon, *this->lock_,
00178         CORBA::INTERNAL ());
00179     // @@ CosEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00180 
00181     consumer = this->consumer_._retn ();
00182   }
00183 
00184   this->deactivate ();
00185 
00186   if (CORBA::is_nil (consumer.in ()))
00187     return;
00188 
00189   try
00190     {
00191       consumer->disconnect_push_consumer ();
00192     }
00193   catch (const CORBA::Exception&)
00194     {
00195       // Ignore exceptions, we must isolate other clients from
00196       // problems on this one.
00197     }
00198 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00199     } /* ! this->is_typed_ec */
00200 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00201 }


Member Data Documentation

CosEventComm::PushConsumer_var TAO_CEC_ProxyPushSupplier::consumer_ [private]

The consumer -- use apply_policy() instead of assigning directly to consumer_. This will keep consumer_ and nopolicy_consumer_ in sync.

Definition at line 186 of file CEC_ProxyPushSupplier.h.

Referenced by cleanup_i(), connect_push_consumer(), consumer(), consumer_i(), disconnect_push_supplier(), and shutdown().

PortableServer::POA_var TAO_CEC_ProxyPushSupplier::default_POA_ [private]

Store the default POA.

Definition at line 206 of file CEC_ProxyPushSupplier.h.

TAO_CEC_EventChannel* TAO_CEC_ProxyPushSupplier::event_channel_ [private]

The Event Channel that owns this object.

Definition at line 169 of file CEC_ProxyPushSupplier.h.

Referenced by _decr_refcnt(), apply_policy_obj(), connect_push_consumer(), disconnect_push_supplier(), push(), push_nocopy(), push_to_consumer(), reactive_push_to_consumer(), and ~TAO_CEC_ProxyPushSupplier().

ACE_Lock* TAO_CEC_ProxyPushSupplier::lock_ [private]

The locking strategy.

Definition at line 179 of file CEC_ProxyPushSupplier.h.

CosEventComm::PushConsumer_var TAO_CEC_ProxyPushSupplier::nopolicy_consumer_ [private]

The consumer without any policies applied.

Definition at line 189 of file CEC_ProxyPushSupplier.h.

Referenced by apply_policy().

CORBA::ULong TAO_CEC_ProxyPushSupplier::refcount_ [private]

The reference count.

Definition at line 182 of file CEC_ProxyPushSupplier.h.

Referenced by _decr_refcnt(), and _incr_refcnt().

ACE_Time_Value TAO_CEC_ProxyPushSupplier::timeout_ [private]

Definition at line 171 of file CEC_ProxyPushSupplier.h.


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:45:00 2010 for TAO_CosEvent by  doxygen 1.4.7