From 0dfeb018b048008367f36db424458fbc19fff402 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 15 Apr 2019 08:55:12 +0200 Subject: Add shutdown operation to the server so that we can trigger a controlled shutdown instead of only a terminate * TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test.idl: * TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test_i.cpp: * TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test_i.h: * TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/server.cpp: --- TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test.idl | 1 + TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test_i.cpp | 11 +++++++++++ TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test_i.h | 5 +++++ TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/server.cpp | 8 ++++---- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test.idl b/TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test.idl index 2a333b4a6e5..f439ca145be 100644 --- a/TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test.idl +++ b/TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test.idl @@ -2,4 +2,5 @@ interface Test { short get_server_num (); oneway void terminate (); + oneway void shutdown (); }; diff --git a/TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test_i.cpp b/TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test_i.cpp index 3091a829c2c..6ef8f1f9542 100644 --- a/TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test_i.cpp +++ b/TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test_i.cpp @@ -4,6 +4,10 @@ #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_stdio.h" +Test_i::Test_i (CORBA::ORB_ptr orb) : orb_ (CORBA::ORB::_duplicate(orb)) +{ +} + CORBA::Short Test_i::get_server_num (void) { @@ -16,3 +20,10 @@ Test_i::terminate (void) ACE_DEBUG ((LM_DEBUG, "(%P|%t) Server received terminate and going to exit\n")); exit (0); } + +void +Test_i::shutdown (void) +{ + ACE_DEBUG ((LM_DEBUG, "(%P|%t) Server received shutdown and going to exit\n")); + orb_->shutdown (); +} diff --git a/TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test_i.h b/TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test_i.h index 984bc38669f..65826facc02 100644 --- a/TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test_i.h +++ b/TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/Test_i.h @@ -12,9 +12,14 @@ class Test_i : public virtual POA_Test { public: + Test_i (CORBA::ORB_ptr orb); virtual CORBA::Short get_server_num (void); virtual void terminate (void); + + virtual void shutdown (void); +private: + CORBA::ORB_var orb_; }; #endif /* TEST_I_H_ */ diff --git a/TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/server.cpp b/TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/server.cpp index dd010b3a7cd..12f26d52584 100644 --- a/TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/server.cpp +++ b/TAO/orbsvcs/tests/ImplRepo/Bug_4152_Regression/server.cpp @@ -15,7 +15,7 @@ class ORB_Runner : public ACE_Task_Base { public: - ORB_Runner (CORBA::ORB_var orb) : orb_(orb) {} + ORB_Runner (CORBA::ORB_ptr orb) : orb_(CORBA::ORB::_duplicate(orb)) {} int svc (void) { this->orb_->run (); @@ -62,7 +62,7 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - ORB_Runner *runner = new ORB_Runner (orb); + ORB_Runner *runner = new ORB_Runner (orb.in ()); int poa_delay = 10; ACE_DEBUG ((LM_DEBUG, "(%P|%t) Start server main\n")); @@ -97,7 +97,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACE_CString base = ACE_CString ("TestObject"); createPOAs (base); - PortableServer::Servant_var test_servant = new Test_i; + PortableServer::Servant_var test_servant = new Test_i (orb.in ()); PortableServer::ObjectId_var object_id = PortableServer::string_to_ObjectId (base.c_str()); @@ -136,7 +136,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) test_ior = orb->object_to_string (tva.in()); base += "_a"; - ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:\n%s\n", base.c_str(), test_ior.in())); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) %C:\n%C\n", base.c_str(), test_ior.in())); table->bind (base.c_str (), test_ior.in ()); runner->wait (); -- cgit v1.2.1