2 #include "Server_Task.h"
5 Server_Task::Server_Task (CORBA::ORB_ptr sorb
,
6 ACE_Manual_Event
&cond
,
7 ACE_Thread_Manager
*thr_mgr
)
8 : ACE_Task_Base (thr_mgr
),
10 sorb_ (CORBA::ORB::_duplicate (sorb
))
15 Server_Task::get_reference ()
17 return Test::Roundtrip::_duplicate (this->rt_var_
.in ());
25 CORBA::Object_var poa_object
=
26 this->sorb_
->resolve_initial_references("RootPOA");
28 PortableServer::POA_var root_poa
=
29 PortableServer::POA::_narrow (poa_object
.in ());
31 if (CORBA::is_nil (root_poa
.in ()))
32 ACE_ERROR_RETURN ((LM_ERROR
,
33 " (%P|%t) Panic: nil RootPOA\n"),
36 PortableServer::POAManager_var poa_manager
=
37 root_poa
->the_POAManager ();
41 ACE_NEW_RETURN (rt_impl
,
42 Roundtrip (this->sorb_
.in ()),
45 PortableServer::ServantBase_var
owner_transfer(rt_impl
);
50 if (CORBA::is_nil (this->rt_var_
.in ()))
52 ACE_ERROR_RETURN ((LM_DEBUG
,
53 "Error activating Test::Roundtrip reference\n"),
57 poa_manager
->activate ();
59 ACE_DEBUG ((LM_DEBUG
, "Server_Task: Object Activation complete\n"));
61 // Signal the main thread to spawn the client
62 this->cond_
.signal ();
66 root_poa
->destroy (true, true);
68 this->sorb_
->destroy ();
70 catch (const CORBA::Exception
& ex
)
72 ex
._tao_print_exception ("Exception caught:");