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.inl.

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.inl.

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 43 of file EC_Lifetime_Utils.inl.

References deactivate().

00044 {
00045   this->deactivate ();
00046 }

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 55 of file EC_Lifetime_Utils.inl.

References deactivate_.

00056 {
00057   this->deactivate_ = 1;
00058 }

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.inl.

References 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     try
00031     {
00032       this->deactivate_ = 0;
00033       this->poa_->deactivate_object (id_);
00034     }
00035     catch (const CORBA::Exception&)
00036     {
00037       // The deactivation can throw...
00038     }
00039   }
00040 }

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 61 of file EC_Lifetime_Utils.inl.

References deactivate_.

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

00062 {
00063   this->deactivate_ = 0;
00064 }

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 49 of file EC_Lifetime_Utils.inl.

00050 {
00051   return this->poa_;
00052 }

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 76 of file EC_Lifetime_Utils.inl.

References deactivate_, id_, and poa_.

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

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 67 of file EC_Lifetime_Utils.inl.

References deactivate_.

Referenced by activate(), and TAO_EC_Deactivated_Object::set_deactivator().

00069 {
00070   this->poa_ = PortableServer::POA::_duplicate (poa);
00071   this->id_ = id;
00072   this->deactivate_ = 1;
00073 }


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 Sun Jan 27 13:42:35 2008 for TAO_RTEvent by doxygen 1.3.6