2 #include "tao/SystemException.h"
3 #include "ace/CORBA_macros.h"
5 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
8 TAO_POA_Manager::lock ()
14 TAO_POA_Manager::activate ()
16 // Lock access to the POAManager for the duration of this transaction
17 TAO_OBJECT_ADAPTER_GUARD;
22 #if (TAO_HAS_MINIMUM_POA == 0)
25 TAO_POA_Manager::hold_requests (CORBA::Boolean wait_for_completion)
27 // Lock access to the POAManager for the duration of this transaction
28 TAO_OBJECT_ADAPTER_GUARD;
30 this->hold_requests_i (wait_for_completion);
34 TAO_POA_Manager::discard_requests (CORBA::Boolean wait_for_completion)
36 // Lock access to the POAManager for the duration of this transaction
37 TAO_OBJECT_ADAPTER_GUARD;
39 this->discard_requests_i (wait_for_completion);
43 TAO_POA_Manager::deactivate (CORBA::Boolean etherealize_objects,
44 CORBA::Boolean wait_for_completion)
46 // Lock access to the POAManager for the duration of this transaction
47 TAO_OBJECT_ADAPTER_GUARD;
49 this->deactivate_i (etherealize_objects, wait_for_completion);
52 #endif /* TAO_HAS_MINIMUM_POA == 0 */
54 ACE_INLINE PortableServer::POAManager::State
55 TAO_POA_Manager::get_state_i ()
60 ACE_INLINE PortableServer::POAManager::State
61 TAO_POA_Manager::get_state ()
63 // Lock access to the POAManager for the duration of this transaction
64 TAO_OBJECT_ADAPTER_GUARD_RETURN (this->state_);
66 return this->get_state_i ();
70 TAO_POA_Manager::generate_manager_id () const
72 // The AdapterManagerId must be unique across all Adapter Managers
73 // (e.g. POAManagers) within a given process. To avoid locking
74 // overhead, the address of the POAManager object is used as the
75 // AdapterManagerId. This guarantees that the AdapterManagerId is
78 // For 64-bit platforms, only the lower 32 bits are used. Hopefully
79 // that will be enough to ensure uniqueness.
81 // This is basically the same trick used in
82 // TAO_GIOP_Invocation::generate_request_id(). However, no right
83 // shifting of 64 bit addresses is performed since the
84 // TAO_POA_Manager object is not large enough to allow that trick.
88 // Note that we reinterpret_cast to an "unsigned long" instead of
89 // CORBA::ULong since we need to first cast to an integer large
90 // enough to hold an address to avoid compile-time warnings on some
93 if (sizeof (this) == 4) // 32 bit address
94 id = static_cast<CORBA::Long> (reinterpret_cast <ptrdiff_t> (this));
96 else if (sizeof (this) == 8) // 64 bit address -- use lower 32 bits
97 id = static_cast<CORBA::Long> (reinterpret_cast <ptrdiff_t> (this) & 0xFFFFFFFFu);
99 // @@ If we ever hit a platform where neither of the above cases are
100 // satisfied, we're up the creek!
103 // // Fallback on an atomically incremented variable specific to the
104 // // ORB, or perhaps specific to the process.
105 // id = ...GENERATE_ID_ATOMICALLY...; // Fallback
107 char* buf = new char [25];
108 ACE_OS::sprintf (buf, "POAManager%d", id);
113 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
116 CORBA::PolicyList& TAO_POA_Manager::get_policies ()
118 return this->policies_;
124 TAO_END_VERSIONED_NAMESPACE_DECL