blob: 80dbe39c9967078f8ac8f9f1f09fa0818c82727f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/* -*- C++ -*- */
// $Id$
#include "IFR_Service.h"
#include "tao/Environment.h"
#include "orbsvcs/Shutdown_Utilities.h"
ACE_RCSID (IFR_Service,
IFR_Server,
"$Id$")
class IFR_Service_Shutdown_Functor : public Shutdown_Functor
{
public:
IFR_Service_Shutdown_Functor (IFR_Service& ifr);
void operator() (int which_signal);
private:
IFR_Service& ifr_;
};
IFR_Service_Shutdown_Functor::IFR_Service_Shutdown_Functor (IFR_Service &ifr)
: ifr_(ifr)
{
}
void
IFR_Service_Shutdown_Functor::operator() (int which_signal)
{
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
"shutting down on signal %d\n", which_signal));
(void) this->ifr_.shutdown ();
}
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
IFR_Service server;
IFR_Service_Shutdown_Functor killer (server);
Service_Shutdown kill_contractor (killer);
try
{
int status = server.init (argc, argv);
if (status != 0)
{
return 1;
}
else
{
server.run ();
status = server.fini ();
if (status == -1)
{
return 1;
}
}
}
catch (const CORBA::SystemException& sysex)
{
sysex._tao_print_exception ("System Exception");
return -1;
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Unknown Exception");
return -1;
}
return 0;
}
|