1 #include "NamingTask.h"
2 #include "orbsvcs/Naming/Naming_Server.h"
3 #include "ace/OS_NS_unistd.h"
6 NamingTask::NamingTask (int argc
, ACE_TCHAR
** argv
)
11 orb_
= CORBA::ORB_init(argc
, argv
, "NamingORB");
14 void NamingTask::waitInit ()
16 // Wait for Naming Service initialized.
17 while (! initialized_
) {
18 ACE_OS::sleep(ACE_Time_Value(0, 100 * 1000));
22 void NamingTask::end()
31 // Get reference to Root POA
32 CORBA::Object_var obj
= orb_
->resolve_initial_references("RootPOA");
33 PortableServer::POA_var poa
= PortableServer::POA::_narrow(obj
.in());
35 // Activate POA Manager
36 PortableServer::POAManager_var poaManager
= poa
->the_POAManager();
37 poaManager
->activate();
39 // Initialize the naming service
40 // We are not going to look for other naming servers
41 TAO_Naming_Server naming
;
42 if (naming
.init(orb_
.in(),
47 std::cout
<< "The Naming Service Task is ready." << std::endl
;
55 std::cerr
<< "Unable to initialize the Naming Service." << std::endl
;
58 catch(const CORBA::Exception
& ex
) {
59 std::cerr
<< "NamingTask::svc() CORBA::Exception: " << ex
<< std::endl
;