2 #include "Client_Task.h"
5 #include "tao/ORB_Core.h"
6 #include "tao/PortableServer/PortableServer.h"
8 Client_Task::Client_Task (const ACE_TCHAR
*ior
,
10 ACE_Thread_Manager
*thr_mgr
)
11 : ACE_Task_Base (thr_mgr
)
13 , corb_ (CORBA::ORB::_duplicate (corb
))
19 Client_Task::svc (void)
23 CORBA::Object_var poa_object
=
24 this->corb_
->resolve_initial_references("RootPOA");
26 PortableServer::POA_var root_poa
=
27 PortableServer::POA::_narrow (poa_object
.in ());
29 if (CORBA::is_nil (root_poa
.in ()))
30 ACE_ERROR_RETURN ((LM_ERROR
,
31 " (%P|%t) Panic: nil RootPOA\n"),
34 PortableServer::POAManager_var poa_manager
=
35 root_poa
->the_POAManager ();
37 Hello
*hello_impl
= 0;
38 ACE_NEW_RETURN (hello_impl
,
39 Hello (this->corb_
.in (),
43 PortableServer::ServantBase_var
owner_transfer(hello_impl
);
45 PortableServer::ObjectId_var id
=
46 root_poa
->activate_object (hello_impl
);
48 CORBA::Object_var object
= root_poa
->id_to_reference (id
.in ());
50 Test::Hello_var hello_servant
= Test::Hello::_narrow (object
.in ());
51 poa_manager
->activate ();
53 ACE_DEBUG((LM_DEBUG
,"Client (%t) optimize_collocation_objects=%d use_global_collocation=%d\n",
54 corb_
->orb_core()->optimize_collocation_objects(),
55 corb_
->orb_core()->use_global_collocation ()));
57 CORBA::Object_var tmp
=
58 this->corb_
->string_to_object (input_
);
60 Test::EventNode_var evNode
=
61 Test::EventNode::_narrow(tmp
.in ());
63 if (CORBA::is_nil (evNode
.in ()))
65 ACE_ERROR_RETURN ((LM_DEBUG
,
66 "Nil Test::EventNode reference <%s>\n",
71 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - Client starting\n"));
73 evNode
->registerHello( hello_servant
.in() );
77 catch (const CORBA::Exception
& ex
)
79 ex
._tao_print_exception ("Exception caught:");