diff options
Diffstat (limited to 'TAO/orbsvcs/Notify_Service/Notify_Server.cpp')
-rw-r--r-- | TAO/orbsvcs/Notify_Service/Notify_Server.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/TAO/orbsvcs/Notify_Service/Notify_Server.cpp b/TAO/orbsvcs/Notify_Service/Notify_Server.cpp index 309c17a733e..53d761344a8 100644 --- a/TAO/orbsvcs/Notify_Service/Notify_Server.cpp +++ b/TAO/orbsvcs/Notify_Service/Notify_Server.cpp @@ -1,43 +1,44 @@ // $Id$ #include "Notify_Service.h" -#include "orbsvcs/Notify/Notify_EventChannelFactory_i.h" -#include "orbsvcs/Notify/Notify_Default_CO_Factory.h" -#include "orbsvcs/Notify/Notify_Default_POA_Factory.h" -#include "orbsvcs/Notify/Notify_Default_Collection_Factory.h" -#include "orbsvcs/Notify/Notify_Default_EMO_Factory.h" + +TAO_Notify_Service notify_service; + +extern "C" void handler (int signum) +{ + // check of sigint + if (signum == SIGINT) + { + ACE_DECLARE_NEW_CORBA_ENV; + notify_service.shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + } +} // Driver function for the TAO Notify Service. int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { - // Init factories. - TAO_Notify_Default_CO_Factory::init_svc (); - TAO_Notify_Default_POA_Factory::init_svc (); - TAO_Notify_Default_Collection_Factory::init_svc (); - TAO_Notify_Default_EMO_Factory::init_svc (); + ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT); - TAO_Notify_Service notify_service; + // Init factories. ACE_DECLARE_NEW_CORBA_ENV; if (notify_service.init (argc, argv ACE_ENV_ARG_PARAMETER) == -1) ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT("Failed to start the Notification Service.\n")), + ACE_LIB_TEXT("Failed to initialize the Notification Service.\n")), 1); ACE_TRY { - notify_service.run (); - notify_service.shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + notify_service.run (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; } ACE_CATCHANY { - notify_service.shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - ACE_LIB_TEXT("Failed to start the Notification Service\n")); + ACE_LIB_TEXT("Failed to run the Notification Service\n")); return 1; } ACE_ENDTRY; |