TAO_EC_Object_Deactivator Class Reference

Utility for deactivating servants from POA. More...

#include <EC_Lifetime_Utils.h>

List of all members.

Public Member Functions

 TAO_EC_Object_Deactivator (void)
 TAO_EC_Object_Deactivator (PortableServer::POA_ptr poa, PortableServer::ObjectId const &id)
 ~TAO_EC_Object_Deactivator (void)
void set_values (PortableServer::POA_ptr poa, PortableServer::ObjectId const &id)
void set_values (TAO_EC_Object_Deactivator &deactivator)
 Take on the state of deactivator. deactivator loses its state.

void allow_deactivation (void)
void disallow_deactivation (void)
void deactivate (void)
PortableServer::POA_var poa (void) const
 Accessor for the POA used in deactivation.


Private Member Functions

 TAO_EC_Object_Deactivator (const TAO_EC_Object_Deactivator &rhs)
TAO_EC_Object_Deactivatoroperator= (const TAO_EC_Object_Deactivator &rhs)

Private Attributes

PortableServer::POA_var poa_
 POA from which the object will be deactivated.

PortableServer::ObjectId id_
 ObjectId of the object to be deactivated.

int deactivate_


Detailed Description

Utility for deactivating servants from POA.

Maintains state necessary to deactivate a servant from POA. Can be told to deactivate a servant explicitly or can do so automagically, in its destructor.

Definition at line 41 of file EC_Lifetime_Utils.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO_EC_Object_Deactivator::TAO_EC_Object_Deactivator void   ) 
 

Default constructor. Deactivation info can be supplied later through set_values ().

Definition at line 8 of file EC_Lifetime_Utils.i.

00009   : poa_ ()
00010   , id_ ()
00011   , deactivate_ (0)
00012 {
00013 }

ACE_INLINE TAO_EC_Object_Deactivator::TAO_EC_Object_Deactivator PortableServer::POA_ptr  poa,
PortableServer::ObjectId const &  id
 

Constructor. Set id which will be deactivated from @ poa in the deactivator's destructor, unless deactivate () or disallow_deactivation () are invoked before the destruction.

Definition at line 16 of file EC_Lifetime_Utils.i.

00019   : poa_ (PortableServer::POA::_duplicate (poa))
00020   , id_ (id)
00021   , deactivate_ (1)
00022 {
00023 }

ACE_INLINE TAO_EC_Object_Deactivator::~TAO_EC_Object_Deactivator void   ) 
 

Destructor. Deactivates id_ from poa_ if those values have been set, and neither deactivate() nor disallow_deactivation() have been invoked.

Definition at line 46 of file EC_Lifetime_Utils.i.

References deactivate().

00047 {
00048   this->deactivate ();
00049 }

TAO_EC_Object_Deactivator::TAO_EC_Object_Deactivator const TAO_EC_Object_Deactivator rhs  )  [private]
 


Member Function Documentation

ACE_INLINE void TAO_EC_Object_Deactivator::allow_deactivation void   ) 
 

Explicitly enable deactivation to happen in destructor or when deactivate() is called.

Definition at line 58 of file EC_Lifetime_Utils.i.

References deactivate_.

00059 {
00060   this->deactivate_ = 1;
00061 }

ACE_INLINE void TAO_EC_Object_Deactivator::deactivate void   ) 
 

Perform deactivation now if and values have been set, and deactivation hasn't happened yet nor has it been explicitly disallowed. CORBA exceptions occurring during deactivation are not propagated. Deactivation will NOT happen in the destructor.

Definition at line 26 of file EC_Lifetime_Utils.i.

References ACE_CATCHANY, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_TRY, ACE_TRY_CHECK, deactivate_, and CORBA::is_nil().

Referenced by TAO_ECG_UDP_Sender::shutdown(), TAO_ECG_UDP_Receiver::shutdown(), TAO_ECG_Mcast_EH::Observer::shutdown(), and ~TAO_EC_Object_Deactivator().

00027 {
00028   if (this->deactivate_ && !CORBA::is_nil (this->poa_.in ()))
00029   {
00030     ACE_DECLARE_NEW_CORBA_ENV;
00031     ACE_TRY
00032     {
00033       this->deactivate_ = 0;
00034       this->poa_->deactivate_object (id_ ACE_ENV_ARG_PARAMETER);
00035       ACE_TRY_CHECK;
00036     }
00037     ACE_CATCHANY
00038     {
00039       // The deactivation can throw...
00040     }
00041     ACE_ENDTRY;
00042   }
00043 }

ACE_INLINE void TAO_EC_Object_Deactivator::disallow_deactivation void   ) 
 

Explicitly disable deactivation from happening in destructor or when deactivate() is called.

Definition at line 64 of file EC_Lifetime_Utils.i.

References deactivate_.

Referenced by TAO_ECG_Mcast_Gateway::run(), and TAO_EC_Deactivated_Object::~TAO_EC_Deactivated_Object().

00065 {
00066   this->deactivate_ = 0;
00067 }

TAO_EC_Object_Deactivator& TAO_EC_Object_Deactivator::operator= const TAO_EC_Object_Deactivator rhs  )  [private]
 

ACE_INLINE PortableServer::POA_var TAO_EC_Object_Deactivator::poa void   )  const
 

Accessor for the POA used in deactivation.

Definition at line 52 of file EC_Lifetime_Utils.i.

00053 {
00054   return this->poa_;
00055 }

ACE_INLINE void TAO_EC_Object_Deactivator::set_values TAO_EC_Object_Deactivator deactivator  ) 
 

Take on the state of deactivator. deactivator loses its state.

Definition at line 79 of file EC_Lifetime_Utils.i.

References deactivate_, id_, and poa_.

00080 {
00081   if (this == &deactivator)
00082     return;
00083 
00084   this->poa_ = deactivator.poa_._retn ();
00085   this->id_ = deactivator.id_;
00086   this->deactivate_ = deactivator.deactivate_;
00087   deactivator.deactivate_ = 0;
00088 }

ACE_INLINE void TAO_EC_Object_Deactivator::set_values PortableServer::POA_ptr  poa,
PortableServer::ObjectId const &  id
 

Set which will be deactivated from in the deactivator's destructor, unless deactivate () or disallow_deactivation () are invoked before the destruction.

Definition at line 70 of file EC_Lifetime_Utils.i.

References deactivate_.

Referenced by TAO_EC_Deactivated_Object::set_deactivator().

00072 {
00073   this->poa_ = PortableServer::POA::_duplicate (poa);
00074   this->id_ = id;
00075   this->deactivate_ = 1;
00076 }


Member Data Documentation

int TAO_EC_Object_Deactivator::deactivate_ [private]
 

Flag indicating whether deactivation will be attempted. The flag is set to false if and haven't been set yet, or if deactivation already happened, or if disallow_deactivation () method is invoked.

Definition at line 103 of file EC_Lifetime_Utils.h.

Referenced by allow_deactivation(), deactivate(), disallow_deactivation(), and set_values().

PortableServer::ObjectId TAO_EC_Object_Deactivator::id_ [private]
 

ObjectId of the object to be deactivated.

Definition at line 97 of file EC_Lifetime_Utils.h.

Referenced by set_values().

PortableServer::POA_var TAO_EC_Object_Deactivator::poa_ [private]
 

POA from which the object will be deactivated.

Definition at line 94 of file EC_Lifetime_Utils.h.

Referenced by set_values().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:15:07 2006 for TAO_RTEvent by doxygen 1.3.6