diff options
Diffstat (limited to 'TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp')
-rw-r--r-- | TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp index 0b1c27df492..1b10ffa023a 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp +++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/server.cpp @@ -3,11 +3,31 @@ #include "test_i.h" #include "ace/OS_NS_stdio.h" +#include "orbsvcs/Shutdown_Utilities.h" ACE_RCSID(Application_Test, server, "$Id$") static const ACE_TCHAR *ior_output_file = ACE_TEXT("iorfile"); +class Service_Shutdown_Functor : public Shutdown_Functor +{ +public: + Service_Shutdown_Functor (CORBA::ORB_ptr orb) + : orb_(CORBA::ORB::_duplicate (orb)) + { + } + + void operator() (int which_signal) + { + ACE_DEBUG ((LM_DEBUG, + "shutting down on signal %d\n", which_signal)); + (void) this->orb_->shutdown (); + } + +private: + CORBA::ORB_var orb_; +}; + static int write_ior_to_file (const char *ior) { @@ -41,10 +61,13 @@ write_ior_to_file (const char *ior) int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { - try - { + try + { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + Service_Shutdown_Functor killer (orb.in ()); + Service_Shutdown kill_contractor (killer); + CORBA::Object_var poa_object = orb->resolve_initial_references ("RootPOA"); @@ -78,6 +101,8 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) root_poa->destroy (1, 1); + + orb->destroy (); } catch (const CORBA::Exception& ex) { |