#include <POAManager.h>
Inheritance diagram for TAO_POA_Manager:
|
Definition at line 135 of file POAManager.h. |
|
Definition at line 21 of file POAManager.cpp. References PortableServer::POAManagerFactory_ptr.
00030 : state_ (PortableServer::POAManager::HOLDING), 00031 lock_ (object_adapter.lock ()), 00032 poa_collection_ (), 00033 object_adapter_ (object_adapter), 00034 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) 00035 id_ (id == 0 ? this->generate_manager_id () : CORBA::string_dup (id)), 00036 poa_manager_factory_ (* dynamic_cast <TAO_POAManager_Factory*> (poa_manager_factory)), 00037 policies_ (policies) 00038 { 00039 poa_manager_factory_._add_ref (); 00040 } |
|
Definition at line 48 of file POAManager.cpp. References TAO_Local_RefCounted_Object::_remove_ref().
00049 { 00050 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) 00051 poa_manager_factory_._remove_ref (); 00052 #endif 00053 } |
|
Reimplemented from CORBA::LocalObject. Definition at line 379 of file POAManager.cpp. References CORBA::ORB::_duplicate().
00380 { 00381 return CORBA::ORB::_duplicate (this->object_adapter_.orb_core ().orb ()); 00382 } |
|
Implements PortableServer::POAManager. Definition at line 17 of file POAManager.inl. References activate_i(), and TAO_OBJECT_ADAPTER_GUARD.
00018 { 00019 // Lock access to the POAManager for the duration of this transaction 00020 TAO_OBJECT_ADAPTER_GUARD; 00021 00022 this->activate_i (); 00023 } |
|
Definition at line 62 of file POAManager.cpp. References adapter_manager_state_changed(), ACE_Unbounded_Set< T >::begin(), ACE_Unbounded_Set< T >::end(), and poa_collection_. Referenced by activate().
00063 { 00064 // This operation changes the state of the POA manager to active. If 00065 // issued while the POA manager is in the inactive state, the 00066 // AdapterInactive exception is raised. Entering the active state 00067 // enables the associated POAs to process requests. 00068 00069 if (this->state_ == PortableServer::POAManager::INACTIVE) 00070 { 00071 throw PortableServer::POAManager::AdapterInactive (); 00072 } 00073 else 00074 { 00075 this->state_ = PortableServer::POAManager::ACTIVE; 00076 // Find the poas that applied the custom servant dispatching 00077 // strategy to launch the dispatching threads. 00078 00079 for (POA_COLLECTION::iterator iterator = this->poa_collection_.begin (); 00080 iterator != this->poa_collection_.end (); 00081 ++iterator) 00082 { 00083 (*iterator)->poa_activated_hook (); 00084 } 00085 } 00086 00087 this->adapter_manager_state_changed (this->state_); 00088 } |
|
Method needed for notifying the IORInterceptors that the state of POAManager changed. Definition at line 160 of file POAManager.cpp. References TAO_IORInterceptor_Adapter::adapter_manager_state_changed(), TAO_ORB_Core::ior_interceptor_adapter(), and TAO_Object_Adapter::orb_core(). Referenced by activate_i(), deactivate_i(), discard_requests_i(), and hold_requests_i().
00161 { 00162 PortableInterceptor::AdapterState adapter_state = 00163 static_cast<PortableInterceptor::AdapterState> (state); 00164 00165 TAO_IORInterceptor_Adapter *ior_adapter = 00166 this->object_adapter_.orb_core ().ior_interceptor_adapter (); 00167 00168 if (ior_adapter) 00169 { 00170 ior_adapter->adapter_manager_state_changed (this->id_.in (), 00171 adapter_state); 00172 } 00173 } |
|
Check the state of this POA manager.
Definition at line 313 of file POAManager.cpp. References TAO_POA_DISCARDING, TAO_POA_HOLDING, and TAO_POA_INACTIVE. Referenced by TAO::Portable_Server::LifespanStrategyTransient::check_state(), and TAO::Portable_Server::LifespanStrategyPersistent::check_state().
00314 { 00315 if (state_ == PortableServer::POAManager::ACTIVE) 00316 { 00317 // When a POA manager is in the active state, the associated 00318 // POAs will receive and start processing requests (assuming 00319 // that appropriate thread resources are available). 00320 return; 00321 } 00322 00323 if (state_ == PortableServer::POAManager::DISCARDING) 00324 { 00325 // When a POA manager is in the discarding state, the associated 00326 // POAs will discard all incoming requests (whose processing has 00327 // not yet begun). When a request is discarded, the TRANSIENT 00328 // system exception, with standard minor code 1, must be 00329 // returned to the client-side to indicate that the request 00330 // should be re-issued. (Of course, an ORB may always reject a 00331 // request for other reasons and raise some other system 00332 // exception.) 00333 throw 00334 CORBA::TRANSIENT ( 00335 CORBA::SystemException::_tao_minor_code ( 00336 TAO_POA_DISCARDING, 00337 1), 00338 CORBA::COMPLETED_NO); 00339 } 00340 00341 if (state_ == PortableServer::POAManager::HOLDING) 00342 { 00343 // When a POA manager is in the holding state, the associated 00344 // POAs will queue incoming requests. The number of requests 00345 // that can be queued is an implementation limit. If this limit 00346 // is reached, the POAs may discard requests and return the 00347 // TRANSIENT system exception, with standard minor code 1, to 00348 // the client to indicate that the client should reissue the 00349 // request. (Of course, an ORB may always reject a request for 00350 // other reasons and raise some other system exception.) 00351 00352 // Since there is no queuing in TAO, we immediately raise a 00353 // TRANSIENT exception. 00354 throw ::CORBA::TRANSIENT ( 00355 CORBA::SystemException::_tao_minor_code (TAO_POA_HOLDING, 1), 00356 CORBA::COMPLETED_NO); 00357 } 00358 00359 if (state_ == PortableServer::POAManager::INACTIVE) 00360 { 00361 // The inactive state is entered when the associated POAs are to 00362 // be shut down. Unlike the discarding state, the inactive state 00363 // is not a temporary state. When a POA manager is in the 00364 // inactive state, the associated POAs will reject new 00365 // requests. The rejection mechanism used is specific to the 00366 // vendor. The GIOP location forwarding mechanism and 00367 // CloseConnection message are examples of mechanisms that could 00368 // be used to indicate the rejection. If the client is 00369 // co-resident in the same process, the ORB could raise the 00370 // OBJ_ADAPTER system exception, with standard minor code 1, to 00371 // indicate that the object implementation is unavailable. 00372 throw ::CORBA::OBJ_ADAPTER ( 00373 CORBA::SystemException::_tao_minor_code (TAO_POA_INACTIVE, 1), 00374 CORBA::COMPLETED_NO); 00375 } 00376 } |
|
Definition at line 46 of file POAManager.inl. References deactivate_i(), and TAO_OBJECT_ADAPTER_GUARD.
00048 { 00049 // Lock access to the POAManager for the duration of this transaction 00050 TAO_OBJECT_ADAPTER_GUARD; 00051 00052 this->deactivate_i (etherealize_objects, wait_for_completion); 00053 } |
|
Definition at line 91 of file POAManager.cpp. References adapter_manager_state_changed(), ACE_Unbounded_Set< T >::begin(), TAO_Root_POA::check_for_valid_wait_for_completions(), TAO_Root_POA::deactivate_all_objects_i(), ACE_Unbounded_Set< T >::end(), poa_collection_, and TAO_Root_POA::poa_deactivated_hook(). Referenced by deactivate().
00093 { 00094 // Is the <wait_for_completion> semantics for this thread correct? 00095 TAO_Root_POA::check_for_valid_wait_for_completions (this->object_adapter_.orb_core (), 00096 wait_for_completion); 00097 00098 // This operation changes the state of the POA manager to 00099 // inactive. If issued while the POA manager is in the inactive 00100 // state, the AdapterInactive exception is raised. Entering the 00101 // inactive state causes the associated POAs to reject requests that 00102 // have not begun to be executed as well as any new requests. 00103 00104 if (this->state_ == PortableServer::POAManager::INACTIVE) 00105 { 00106 throw PortableServer::POAManager::AdapterInactive (); 00107 } 00108 else 00109 { 00110 this->state_ = PortableServer::POAManager::INACTIVE; 00111 } 00112 00113 // After changing the state, if the etherealize_objects parameter is: 00114 // 00115 // a) TRUE - the POA manager will cause all associated POAs that 00116 // have the RETAIN and USE_SERVANT_MANAGER policies to perform the 00117 // etherealize operation on the associated servant manager for all 00118 // active objects. 00119 // 00120 // b) FALSE - the etherealize operation is not called. The purpose 00121 // is to provide developers with a means to shut down POAs in a 00122 // crisis (for example, unrecoverable error) situation. 00123 00124 // If the wait_for_completion parameter is FALSE, this operation 00125 // will return immediately after changing the state. If the 00126 // parameter is TRUE and the current thread is not in an invocation 00127 // context dispatched by some POA belonging to the same ORB as this 00128 // POA, this operation does not return until there are no actively 00129 // executing requests in any of the POAs associated with this POA 00130 // manager (that is, all requests that were started prior to the 00131 // state change have completed) and, in the case of a TRUE 00132 // etherealize_objects, all invocations of etherealize have 00133 // completed for POAs having the RETAIN and USE_SERVANT_MANAGER 00134 // policies. If the parameter is TRUE and the current thread is in 00135 // an invocation context dispatched by some POA belonging to the 00136 // same ORB as this POA the BAD_INV_ORDER exception is raised and 00137 // the state is not changed. 00138 00139 for (POA_COLLECTION::iterator iterator = this->poa_collection_.begin (); 00140 iterator != this->poa_collection_.end (); 00141 ++iterator) 00142 { 00143 TAO_Root_POA *poa = *iterator; 00144 // Notify the poas that applied the custom servant dispatching 00145 // strategy to stop the dispatching threads. 00146 poa->poa_deactivated_hook (); 00147 00148 poa->deactivate_all_objects_i (etherealize_objects, wait_for_completion); 00149 } 00150 00151 // If the ORB::shutdown operation is called, it makes a call on 00152 // deactivate with a TRUE etherealize_objects parameter for each POA 00153 // manager known in the process; the wait_for_completion parameter 00154 // to deactivate will be the same as the similarly named parameter 00155 // of ORB::shutdown. 00156 this->adapter_manager_state_changed (this->state_); 00157 } |
|
Definition at line 37 of file POAManager.inl. References discard_requests_i(), and TAO_OBJECT_ADAPTER_GUARD.
00038 { 00039 // Lock access to the POAManager for the duration of this transaction 00040 TAO_OBJECT_ADAPTER_GUARD; 00041 00042 this->discard_requests_i (wait_for_completion); 00043 } |
|
Definition at line 229 of file POAManager.cpp. References adapter_manager_state_changed(), ACE_Unbounded_Set< T >::begin(), TAO_Root_POA::check_for_valid_wait_for_completions(), ACE_Unbounded_Set< T >::end(), poa_collection_, and TAO_Root_POA::wait_for_completions(). Referenced by discard_requests().
00230 { 00231 // Is the <wait_for_completion> semantics for this thread correct? 00232 TAO_Root_POA::check_for_valid_wait_for_completions (this->object_adapter_.orb_core (), 00233 wait_for_completion); 00234 00235 // This operation changes the state of the POA manager to 00236 // discarding. If issued while the POA manager is in the inactive 00237 // state, the AdapterInactive exception is raised. Entering the 00238 // discarding state causes the associated POAs to discard incoming 00239 // requests. In addition, any requests that have been queued but 00240 // have not started executing are discarded. When a request is 00241 // discarded, a TRANSIENT system exception is returned to the 00242 // client. 00243 00244 if (this->state_ == PortableServer::POAManager::INACTIVE) 00245 { 00246 throw PortableServer::POAManager::AdapterInactive (); 00247 } 00248 else 00249 { 00250 this->state_ = PortableServer::POAManager::DISCARDING; 00251 } 00252 00253 // If the wait_for_completion parameter is FALSE, this operation 00254 // returns immediately after changing the state. If the 00255 // parameter is TRUE and the current thread is not in an 00256 // invocation context dispatched by some POA belonging to the 00257 // same ORB as this POA, this operation does not return until 00258 // either there are no actively executing requests in any of the 00259 // POAs associated with this POA manager (that is, all requests 00260 // that were started prior to the state change have completed) 00261 // or the state of the POA manager is changed to a state other 00262 // than discarding. If the parameter is TRUE and the current 00263 // thread is in an invocation context dispatched by some POA 00264 // belonging to the same ORB as this POA the BAD_INV_ORDER 00265 // exception is raised and the state is not changed. 00266 00267 if (wait_for_completion) 00268 { 00269 for (POA_COLLECTION::iterator iterator = this->poa_collection_.begin (); 00270 iterator != this->poa_collection_.end (); 00271 ++iterator) 00272 { 00273 TAO_Root_POA *poa = *iterator; 00274 poa->wait_for_completions (wait_for_completion); 00275 } 00276 } 00277 00278 this->adapter_manager_state_changed (this->state_); 00279 } |
|
Generate an id for this POAManager.
Definition at line 73 of file POAManager.inl. References ACE_OS::sprintf().
00074 { 00075 // The AdapterManagerId must be unique across all Adapter Managers 00076 // (e.g. POAManagers) within a given process. To avoid locking 00077 // overhead, the address of the POAManager object is used as the 00078 // AdapterManagerId. This guarantees that the AdapterManagerId is 00079 // unique. 00080 // 00081 // For 64-bit platforms, only the lower 32 bits are used. Hopefully 00082 // that will be enough to ensure uniqueness. 00083 00084 // This is basically the same trick used in 00085 // TAO_GIOP_Invocation::generate_request_id(). However, no right 00086 // shifting of 64 bit addresses is performed since the 00087 // TAO_POA_Manager object is not large enough to allow that trick. 00088 00089 CORBA::Long id = 0; 00090 00091 // Note that we reinterpret_cast to an "unsigned long" instead of 00092 // CORBA::ULong since we need to first cast to an integer large 00093 // enough to hold an address to avoid compile-time warnings on some 00094 // 64-bit platforms. 00095 00096 if (sizeof (this) == 4) // 32 bit address 00097 id = reinterpret_cast <ptrdiff_t> (this); 00098 00099 else if (sizeof (this) == 8) // 64 bit address -- use lower 32 bits 00100 id = reinterpret_cast <ptrdiff_t> (this) & 0xFFFFFFFFu; 00101 00102 // @@ If we ever hit a platform where neither of the above cases are 00103 // satisfied, we're up the creek! 00104 00105 // else 00106 // // Fallback on an atomically incremented variable specific to the 00107 // // ORB, or perhaps specific to the process. 00108 // id = ...GENERATE_ID_ATOMICALLY...; // Fallback 00109 00110 char* buf = new char [25]; 00111 ACE_OS::sprintf (buf, "POAManager%d", id); 00112 return buf; 00113 } |
|
Implements PortableServer::POAManager. Definition at line 56 of file POAManager.cpp. References CORBA::string_dup().
00057 { 00058 return CORBA::string_dup (this->id_.in ()); 00059 } |
|
Definition at line 119 of file POAManager.inl.
00120 { 00121 return this->policies_; 00122 } |
|
Implements PortableServer::POAManager. Definition at line 64 of file POAManager.inl. References get_state_i(), and TAO_OBJECT_ADAPTER_GUARD_RETURN.
00065 { 00066 // Lock access to the POAManager for the duration of this transaction 00067 TAO_OBJECT_ADAPTER_GUARD_RETURN (this->state_); 00068 00069 return this->get_state_i (); 00070 } |
|
Definition at line 58 of file POAManager.inl. Referenced by TAO::Portable_Server::LifespanStrategyTransient::check_state(), and get_state().
00059 { 00060 return this->state_; 00061 } |
|
Definition at line 28 of file POAManager.inl. References hold_requests_i(), and TAO_OBJECT_ADAPTER_GUARD.
00029 { 00030 // Lock access to the POAManager for the duration of this transaction 00031 TAO_OBJECT_ADAPTER_GUARD; 00032 00033 this->hold_requests_i (wait_for_completion); 00034 } |
|
Definition at line 178 of file POAManager.cpp. References adapter_manager_state_changed(), ACE_Unbounded_Set< T >::begin(), TAO_Root_POA::check_for_valid_wait_for_completions(), ACE_Unbounded_Set< T >::end(), poa_collection_, and TAO_Root_POA::wait_for_completions(). Referenced by hold_requests().
00179 { 00180 // Is the <wait_for_completion> semantics for this thread correct? 00181 TAO_Root_POA::check_for_valid_wait_for_completions (this->object_adapter_.orb_core (), 00182 wait_for_completion); 00183 00184 // This operation changes the state of the POA manager to 00185 // holding. If issued while the POA manager is in the inactive 00186 // state, the AdapterInactive exception is raised. Entering the 00187 // holding state causes the associated POAs to queue incoming 00188 // requests. Any requests that have been queued but have not 00189 // started executing will continue to be queued while in the holding 00190 // state. 00191 00192 if (this->state_ == PortableServer::POAManager::INACTIVE) 00193 { 00194 throw PortableServer::POAManager::AdapterInactive (); 00195 } 00196 else 00197 { 00198 this->state_ = PortableServer::POAManager::HOLDING; 00199 } 00200 00201 // If the wait_for_completion parameter is FALSE, this operation 00202 // returns immediately after changing the state. If the parameter is 00203 // TRUE and the current thread is not in an invocation context 00204 // dispatched by some POA belonging to the same ORB as this POA, 00205 // this operation does not return until either there are no actively 00206 // executing requests in any of the POAs associated with this POA 00207 // manager (that is, all requests that were started prior to the 00208 // state change have completed) or the state of the POA manager is 00209 // changed to a state other than holding. If the parameter is TRUE 00210 // and the current thread is in an invocation context dispatched by 00211 // some POA belonging to the same ORB as this POA the BAD_INV_ORDER 00212 // exception is raised and the state is not changed. 00213 00214 if (wait_for_completion) 00215 { 00216 for (POA_COLLECTION::iterator iterator = this->poa_collection_.begin (); 00217 iterator != this->poa_collection_.end (); 00218 ++iterator) 00219 { 00220 TAO_Root_POA *poa = *iterator; 00221 poa->wait_for_completions (wait_for_completion); 00222 } 00223 } 00224 00225 this->adapter_manager_state_changed (this->state_); 00226 } |
|
Definition at line 11 of file POAManager.inl.
00012 { 00013 return this->lock_; 00014 } |
|
Definition at line 307 of file POAManager.cpp. References ACE_Unbounded_Set< T >::insert(), and poa_collection_. Referenced by TAO_Root_POA::TAO_Root_POA().
00308 { 00309 return this->poa_collection_.insert (poa); 00310 } |
|
Definition at line 284 of file POAManager.cpp. References ACE_Unbounded_Set< T >::is_empty(), poa_collection_, ACE_Unbounded_Set< T >::remove(), and TAO_POAManager_Factory::remove_poamanager(). Referenced by TAO_Root_POA::complete_destruction_i(), and TAO_Root_POA::TAO_Root_POA().
00285 { 00286 int const result = this->poa_collection_.remove (poa); 00287 00288 // The #if really only needs to go around the 00289 // "this->poa_manager_factory_.remove_poamanager (this);" line, but it's 00290 // moved out as an optimization for now. If additional non-CORBA/e and 00291 // non-minimum POA code needs to go in that clause the #if would have to 00292 // move back in. 00293 00294 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) 00295 if (result == 0) 00296 { 00297 if (this->poa_collection_.is_empty ()) 00298 { 00299 this->poa_manager_factory_.remove_poamanager (this); 00300 } 00301 } 00302 #endif 00303 return result; 00304 } |
|
Definition at line 61 of file POAManager.h. |
|
Definition at line 60 of file POAManager.h. |
|
Definition at line 141 of file POAManager.h. |
|
Definition at line 133 of file POAManager.h. |
|
Definition at line 139 of file POAManager.h. |
|
Definition at line 137 of file POAManager.h. Referenced by activate_i(), deactivate_i(), discard_requests_i(), hold_requests_i(), register_poa(), and remove_poa(). |
|
Definition at line 145 of file POAManager.h. |
|
Definition at line 146 of file POAManager.h. |
|
Definition at line 131 of file POAManager.h. |