Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / Bug_2084_Regression / Client_Task.cpp
blob020c59454fd0ee7fa51de4e4aafbb4cc2f872b04
2 #include "Client_Task.h"
3 #include "TestC.h"
4 #include "Hello.h"
5 #include "tao/ORB_Core.h"
6 #include "tao/PortableServer/PortableServer.h"
8 Client_Task::Client_Task (const ACE_TCHAR *ior,
9 CORBA::ORB_ptr corb,
10 ACE_Thread_Manager *thr_mgr)
11 : ACE_Task_Base (thr_mgr)
12 , input_ (ior)
13 , corb_ (CORBA::ORB::_duplicate (corb))
18 int
19 Client_Task::svc ()
21 try
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"),
32 1);
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 ()),
40 1);
42 PortableServer::ServantBase_var owner_transfer(hello_impl);
44 PortableServer::ObjectId_var id =
45 root_poa->activate_object (hello_impl);
47 CORBA::Object_var object = root_poa->id_to_reference (id.in ());
49 Test::Hello_var hello_servant = Test::Hello::_narrow (object.in ());
50 poa_manager->activate ();
52 ACE_DEBUG((LM_DEBUG,"Client (%t) optimize_collocation_objects=%d use_global_collocation=%d\n",
53 corb_->orb_core()->optimize_collocation_objects(),
54 corb_->orb_core()->use_global_collocation ()));
56 CORBA::Object_var tmp =
57 this->corb_->string_to_object (input_);
59 Test::EventNode_var evNode=
60 Test::EventNode::_narrow(tmp.in ());
62 if (CORBA::is_nil (evNode.in ()))
64 ACE_ERROR_RETURN ((LM_DEBUG,
65 "Nil Test::EventNode reference <%s>\n",
66 input_),
67 1);
70 ACE_DEBUG ((LM_DEBUG, "(%P|%t) - Client starting\n"));
72 evNode->registerHello( hello_servant.in());
74 evNode->shutdown ();
76 catch (const CORBA::Exception& ex)
78 ex._tao_print_exception ("Exception caught:");
79 return 1;
82 return 0;