Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / orbsvcs / Notify_Service / Notify_Server.cpp
blob6a0394be9aa3f80fcb992d701fc495e1f5fc5325
1 #include "orbsvcs/Log_Macros.h"
2 #include "Notify_Service.h"
3 #include "orbsvcs/orbsvcs/Notify/Properties.h"
5 // Must include this file to get a static initializer
6 #include "tao/Valuetype/Valuetype_Adapter_Impl.h"
8 #include "ace/OS_main.h"
10 #include "orbsvcs/Shutdown_Utilities.h"
11 #include "tao/debug.h"
14 class Notify_Service_Shutdown_Functor
15 : public Shutdown_Functor
17 public:
18 Notify_Service_Shutdown_Functor (TAO_Notify_Service_Driver& svc);
20 void operator() (int which_signal);
22 private:
23 TAO_Notify_Service_Driver& svc_;
26 Notify_Service_Shutdown_Functor::Notify_Service_Shutdown_Functor (TAO_Notify_Service_Driver& svc)
27 : svc_ (svc)
31 void
32 Notify_Service_Shutdown_Functor::operator() (int which_signal)
34 if (TAO_debug_level > 0)
35 ORBSVCS_DEBUG ((LM_DEBUG,
36 "shutting down on signal %d\n", which_signal));
37 (void) this->svc_.fini ();
40 // Driver function for the TAO Notify Service.
42 int
43 ACE_TMAIN (int argc, ACE_TCHAR *argv[])
45 TAO_Notify_Service_Driver notify_service;
47 Notify_Service_Shutdown_Functor killer (notify_service);
48 Service_Shutdown kill_contractor (killer);
50 try
52 if (notify_service.init (argc, argv) == -1)
53 ORBSVCS_ERROR_RETURN ((LM_ERROR,
54 ACE_TEXT("Failed to initialize the Notification Service.\n")),
55 1);
57 notify_service.run ();
59 catch (const CORBA::Exception& ex)
61 ex._tao_print_exception (
62 ACE_TEXT ("Failed to run the Notification Service\n"));
63 return 1;
66 return 0;