Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / orbsvcs / IFR_Service / IFR_Server.cpp
blobc7a6dba46c32d6107150c78128f997c0f657dd09
1 /* -*- C++ -*- */
2 #include "orbsvcs/Log_Macros.h"
3 #include "IFR_Service.h"
4 #include "tao/Environment.h"
5 #include "orbsvcs/Shutdown_Utilities.h"
7 class IFR_Service_Shutdown_Functor : public Shutdown_Functor
9 public:
10 IFR_Service_Shutdown_Functor (IFR_Service& ifr);
12 void operator() (int which_signal);
13 private:
14 IFR_Service& ifr_;
17 IFR_Service_Shutdown_Functor::IFR_Service_Shutdown_Functor (IFR_Service &ifr)
18 : ifr_(ifr)
22 void
23 IFR_Service_Shutdown_Functor::operator() (int which_signal)
25 if (TAO_debug_level > 0)
26 ORBSVCS_DEBUG ((LM_DEBUG,
27 "shutting down on signal %d\n", which_signal));
28 (void) this->ifr_.shutdown ();
31 int
32 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
34 IFR_Service server;
36 IFR_Service_Shutdown_Functor killer (server);
37 Service_Shutdown kill_contractor (killer);
39 try
41 int status = server.init (argc, argv);
43 if (status != 0)
45 return 1;
47 else
49 server.run ();
51 status = server.fini ();
53 if (status == -1)
55 return 1;
59 catch (const CORBA::SystemException& sysex)
61 sysex._tao_print_exception ("System Exception");
62 return -1;
64 catch (const CORBA::Exception& ex)
66 ex._tao_print_exception ("Unknown Exception");
67 return -1;
69 return 0;