blob: 9d450fb754d0dea55e5b0eb819785ead3f4239c1 (
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
|
// $Id$
#include "Naming_Service.h"
#include "ace/OS_main.h"
#include "orbsvcs/Shutdown_Utilities.h"
#include "tao/debug.h"
#include "tao/ImR_Client/ImR_Client.h"
class Naming_Svc_Shutdown : public Shutdown_Functor
{
public:
Naming_Svc_Shutdown(TAO_Naming_Service& ns);
void operator() (int which_signal);
private:
TAO_Naming_Service& ns_;
};
Naming_Svc_Shutdown::Naming_Svc_Shutdown (TAO_Naming_Service &ns)
: ns_(ns)
{
}
void
Naming_Svc_Shutdown::operator() (int which_signal)
{
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
"Name Service: shutting down on signal %d\n",
which_signal));
(void) this->ns_.shutdown ();
}
// Driver function for the TAO Naming Service.
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
TAO_Naming_Service naming_service;
// Stuff to insure that we're gracefully shut down...
Naming_Svc_Shutdown killer (naming_service);
Service_Shutdown kill_contractor(killer);
if (naming_service.init (argc, argv) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT("Failed to start the Naming Service.\n")),
1);
ACE_DECLARE_NEW_CORBA_ENV;
ACE_TRY
{
naming_service.run ();
}
ACE_CATCHANY
{
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "NamingService");
return 1;
}
ACE_ENDTRY;
naming_service.fini ();
return 0;
}
|