diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-03-19 23:23:29 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-03-19 23:23:29 +0000 |
commit | 23b12ae2fb740a0029899357497629a105cef550 (patch) | |
tree | a6a8471c0a0c83f8fcd004b91e97bcafaa21c453 | |
parent | 43d7fc8bd159e2a831683f828af7785246927dfe (diff) | |
download | ATCD-23b12ae2fb740a0029899357497629a105cef550.tar.gz |
ChangeLogTag: Mon Mar 19 15:09:52 2001 Irfan Pyarali <irfan@cs.wustl.edu>
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 25 | ||||
-rw-r--r-- | TAO/TAOACE.dsw | 3 | ||||
-rw-r--r-- | TAO/examples/POA/Loader/Server_Manager.cpp | 12 | ||||
-rw-r--r-- | TAO/examples/POA/Loader/Server_Manager.h | 25 | ||||
-rw-r--r-- | TAO/examples/POA/On_Demand_Loading/Server_Manager.cpp | 10 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 2 | ||||
-rw-r--r-- | TAO/tests/POA/wait_for_completion/wait_for_completion.cpp | 13 |
7 files changed, 70 insertions, 20 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 6fff847f0ea..40791e5bfad 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,28 @@ +Mon Mar 19 15:09:52 2001 Irfan Pyarali <irfan@cs.wustl.edu> + + * examples/POA/On_Demand_Loading/Server_Manager.cpp (create_activator): + * examples/POA/On_Demand_Loading/Server_Manager.cpp (create_locator): + * examples/POA/Loader/Server_Manager.cpp (create_activator): + * examples/POA/Loader/Server_Manager.cpp (create_locator): + + Fixed Servant Managers and Servant Activators leaks. + + * tao/ORB_Core.cpp (collocation_strategy): When looking for a + valid servant ORB, the following code was used: + + stub->servant_orb_ptr () != 0 + + Unfortunately, servant_orb_ptr() duplicated the ORB. Correct + solution is to use: + + stub->servant_orb_var ().in () != CORBA::ORB::_nil () + + * tests/POA/wait_for_completion/wait_for_completion.cpp (main): + The servant was not removed from the POA at the end of the + program. When the POA died in the static destructors, it tried + to reach for the dead servant causing a seg fault. This was + fixed by destroying the POA before the servant died. + Mon Mar 19 14:20:38 2001 Ossama Othman <ossama@uci.edu> * orbsvcs/tests/Makefile (DIRS): diff --git a/TAO/TAOACE.dsw b/TAO/TAOACE.dsw index 674591db9cd..be7d8119e98 100644 --- a/TAO/TAOACE.dsw +++ b/TAO/TAOACE.dsw @@ -959,6 +959,9 @@ Package=<4> Begin Project Dependency
Project_Dep_Name gperf_lib
End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name ACE DLL
+ End Project Dependency
}}}
###############################################################################
diff --git a/TAO/examples/POA/Loader/Server_Manager.cpp b/TAO/examples/POA/Loader/Server_Manager.cpp index fe07a02a6b8..40919be3509 100644 --- a/TAO/examples/POA/Loader/Server_Manager.cpp +++ b/TAO/examples/POA/Loader/Server_Manager.cpp @@ -246,16 +246,18 @@ Server_i::create_activator (PortableServer::POA_var first_poa) { // An Servant Activator object is created which will activate // the servant on demand. - ACE_NEW_RETURN (servant_activator_impl_, + PortableServer::ServantManager_ptr temp_servant_activator; + ACE_NEW_RETURN (temp_servant_activator, ServantActivator_i (orb_.in (), "Generic_Servant", "supply_servant", "destroy_servant"), 0); + this->servant_activator_ = temp_servant_activator; // Set ServantActivator_i object as the servant_manager of // firstPOA. - first_poa->set_servant_manager (servant_activator_impl_, + first_poa->set_servant_manager (this->servant_activator_.in (), ACE_TRY_ENV); ACE_TRY_CHECK; @@ -291,17 +293,19 @@ Server_i::create_locator (PortableServer::POA_var second_poa) { // An Servant Locator object is created which will activate // the servant on demand. - ACE_NEW_RETURN (servant_locator_impl_, + PortableServer::ServantManager_ptr temp_servant_locator; + ACE_NEW_RETURN (temp_servant_locator, ServantLocator_i (orb_.in (), "Generic_Servant", "supply_servant", "destroy_servant"), 0); + this->servant_locator_ = temp_servant_locator; // Set ServantLocator_i object as the servant Manager of // secondPOA. - second_poa->set_servant_manager (servant_locator_impl_, + second_poa->set_servant_manager (this->servant_locator_.in (), ACE_TRY_ENV); ACE_TRY_CHECK; diff --git a/TAO/examples/POA/Loader/Server_Manager.h b/TAO/examples/POA/Loader/Server_Manager.h index 575b60be0ac..2f08852b710 100644 --- a/TAO/examples/POA/Loader/Server_Manager.h +++ b/TAO/examples/POA/Loader/Server_Manager.h @@ -46,24 +46,24 @@ public: int init (int argc, char **argv); // Initialisation of the ORB and poa. - - PortableServer::POA_ptr create_poa (const char* name, + + PortableServer::POA_ptr create_poa (const char* name, int servant_retention_policy); // This method creates a POA from the root_poa with emphasis being // on the servant_retention_policy which decides the use of the // ServantActivator or ServantLocator interfaces. The // servent_retention_policy value is 1 for the RETAIN policy and 0 // for the NONRETAIN policy. - + int create_activator (PortableServer::POA_var first_poa); // A ServantActivator object is created and initialised. int create_locator (PortableServer::POA_var second_poa); // A ServantActivator object is created and initialised. - + int run (void); // The server is executed. - + private: int parse_args (int argc, char **argv); // Parses the input arguments. @@ -71,14 +71,14 @@ private: int write_iors_to_file (const char *first_ior, const char *second_ior); // The IORs are written to a file for future use. - + char *ior_output_file_; // Default ior file. - + CORBA::ORB_var orb_; // The orb pointer. - CORBA::PolicyList policies_; + CORBA::PolicyList policies_; // The poa policicies. PortableServer::POA_var root_poa_; @@ -92,15 +92,12 @@ private: CORBA::Object_var second_foo_; // The object pointer used by the Servant Locator. - - ServantActivator_i *servant_activator_impl_; + + PortableServer::ServantManager_var servant_activator_; // The servant activator object. - ServantLocator_i *servant_locator_impl_; + PortableServer::ServantManager_var servant_locator_; // The servant locator object. }; #endif /* SERVER_MANAGER_H */ - - - diff --git a/TAO/examples/POA/On_Demand_Loading/Server_Manager.cpp b/TAO/examples/POA/On_Demand_Loading/Server_Manager.cpp index 966751c4dd4..f24dae3d4fd 100644 --- a/TAO/examples/POA/On_Demand_Loading/Server_Manager.cpp +++ b/TAO/examples/POA/On_Demand_Loading/Server_Manager.cpp @@ -2,16 +2,21 @@ #include "Server_Manager.h" #include "ace/Get_Opt.h" + ACE_RCSID(On_Demand_Loading, Server_Manager, "$Id$") Server_i::Server_i(void) : ior_output_file_ (0), - policies_ (4) + policies_ (4), + servant_activator_impl_ (0), + servant_locator_impl_ (0) { } Server_i::~Server_i(void) { + delete servant_activator_impl_; + delete servant_locator_impl_; } // This method parses the input. @@ -361,6 +366,9 @@ Server_i::run (void) // Run the ORB. orb_->run (ACE_TRY_ENV); ACE_TRY_CHECK; + + orb_->destroy (ACE_TRY_ENV); + ACE_TRY_CHECK; } ACE_CATCHANY { diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index 48ee1aaf242..6b6ea167185 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -2975,7 +2975,7 @@ TAO_ORB_Core::collocation_strategy (CORBA::Object_ptr object) { TAO_Stub *stub = object->_stubobj (); - if (stub->servant_orb_ptr () != 0 && + if (stub->servant_orb_var ().in () != CORBA::ORB::_nil () && stub->servant_orb_var ()->orb_core () != 0 && object->_servant () != 0) { diff --git a/TAO/tests/POA/wait_for_completion/wait_for_completion.cpp b/TAO/tests/POA/wait_for_completion/wait_for_completion.cpp index 0af736281c0..8cfb4941945 100644 --- a/TAO/tests/POA/wait_for_completion/wait_for_completion.cpp +++ b/TAO/tests/POA/wait_for_completion/wait_for_completion.cpp @@ -109,6 +109,8 @@ main (int argc, test_var test_object = servant._this (ACE_TRY_ENV); ACE_TRY_CHECK; + int expected_exception_raised = 0; + ACE_TRY_EX (first_poa) { servant.test_poa (first_poa.in ()); @@ -119,6 +121,7 @@ main (int argc, ACE_CATCH (CORBA::BAD_INV_ORDER, ex) { // This is the correct exception! Ignore + expected_exception_raised = 1; } ACE_CATCHANY { @@ -128,10 +131,20 @@ main (int argc, ACE_ENDTRY; ACE_CHECK_RETURN (-1); + // Make sure an exception was raised and it was of the correct + // type. + ACE_ASSERT (expected_exception_raised); + + // In non-debug compiles, asserts will disappear. + ACE_UNUSED_ARG (expected_exception_raised); + servant.test_poa (second_poa.in ()); test_object->destroy_poa (ACE_TRY_ENV); ACE_TRY_CHECK; + + first_poa->destroy (1, 1, ACE_TRY_ENV); + ACE_TRY_CHECK; } ACE_CATCHANY { |