diff options
Diffstat (limited to 'TAO/tao/PortableServer/Object_Adapter.cpp')
-rw-r--r-- | TAO/tao/PortableServer/Object_Adapter.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/TAO/tao/PortableServer/Object_Adapter.cpp b/TAO/tao/PortableServer/Object_Adapter.cpp index 45519170d6e..224b531864f 100644 --- a/TAO/tao/PortableServer/Object_Adapter.cpp +++ b/TAO/tao/PortableServer/Object_Adapter.cpp @@ -11,7 +11,6 @@ #include "tao/PortableServer/Default_Servant_Dispatcher.h" #include "tao/PortableServer/Collocated_Object_Proxy_Broker.h" #include "tao/PortableServer/POAManager.h" -#include "tao/PortableServer/POAManagerFactory.h" #include "tao/PortableServer/Servant_Base.h" // -- ACE Include -- @@ -592,17 +591,14 @@ TAO_Object_Adapter::open (ACE_ENV_SINGLE_ARG_DECL) TAO_Default_Servant_Dispatcher); } - ACE_NEW_THROW_EX (this->poa_manager_factory_, - TAO_POAManager_Factory (*this), + TAO_POA_Manager *poa_manager; + ACE_NEW_THROW_EX (poa_manager, + TAO_POA_Manager (*this), CORBA::NO_MEMORY ()); - - ::CORBA::PolicyList policy; - PortableServer::POAManager_var poa_manager - = poa_manager_factory_->create_POAManager (TAO_DEFAULT_ROOTPOAMANAGER_NAME, - policy - ACE_ENV_ARG_PARAMETER); ACE_CHECK; + PortableServer::POAManager_var safe_poa_manager = poa_manager; + // This makes sure that the default resources are open when the Root // POA is created. this->orb_core_.thread_lane_resources_manager ().open_default_resources (ACE_ENV_SINGLE_ARG_PARAMETER); @@ -643,7 +639,7 @@ TAO_Object_Adapter::open (ACE_ENV_SINGLE_ARG_DECL) TAO_Root_POA::String root_poa_name (TAO_DEFAULT_ROOTPOA_NAME); this->root_ = this->servant_dispatcher_->create_Root_POA (root_poa_name, - poa_manager.in (), + *poa_manager, policies, this->lock (), this->thread_lock (), @@ -666,6 +662,11 @@ TAO_Object_Adapter::open (ACE_ENV_SINGLE_ARG_DECL) // for this servant. this->root_->establish_components (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; + + // Release the POA_Manager_var since we got here without error. The + // TAO_POA object takes ownership of the POA_Manager object + // (actually it shares the ownership with its peers). + (void) safe_poa_manager._retn (); } void @@ -683,18 +684,14 @@ TAO_Object_Adapter::close (int wait_for_completion // destroyed. In the case of the POA, this means that all object // etherealizations have finished and root POA has been destroyed // (implying that all descendent POAs have also been destroyed). + TAO_Root_POA *root = 0; - TAO_POAManager_Factory* factory = 0; { ACE_GUARD (ACE_Lock, ace_mon, this->lock ()); if (this->root_ == 0) return; root = this->root_; this->root_ = 0; - if (this->poa_manager_factory_ == 0) - return; - factory = this->poa_manager_factory_; - this->poa_manager_factory_ = 0; } CORBA::Boolean etherealize_objects = 1; root->destroy (etherealize_objects, @@ -702,7 +699,6 @@ TAO_Object_Adapter::close (int wait_for_completion ACE_ENV_ARG_PARAMETER); ACE_CHECK; ::CORBA::release (root); - ::CORBA::release (factory); } void |