1 #include "Client_Task.h"
3 Client_Task::Client_Task (Test::Hello_ptr receiver
,
5 ACE_Thread_Manager
*thr_mgr
)
6 : ACE_Task_Base (thr_mgr
)
7 , receiver_ (Test::Hello::_duplicate (receiver
))
8 , handler_ (new Reply_Handler(receiver
, orb
))
9 , handler_var_ (handler_
->_this())
10 , orb_ (CORBA::ORB::_duplicate (orb
))
14 Client_Task::~Client_Task (void)
19 Client_Task::svc (void)
21 // ACE_DEBUG ((LM_DEBUG, "(%P|%t) Starting client task\n"));
25 CORBA::Object_var object
=
26 this->orb_
->resolve_initial_references ("PolicyCurrent");
28 CORBA::PolicyCurrent_var policy_current
=
29 CORBA::PolicyCurrent::_narrow (object
.in ());
31 TimeBase::TimeT timeout_period
= 20 * 1000;
33 CORBA::Any timeout_as_any
;
34 timeout_as_any
<<= timeout_period
;
36 CORBA::PolicyList
policy_list (1);
37 policy_list
.length (1);
39 this->orb_
->create_policy (Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE
,
42 policy_current
->set_policy_overrides (policy_list
,
45 policy_list
[0]->destroy();
47 // Start 25 separate concurrent request streams
48 for (CORBA::Short i
= 0; i
!= 25; ++i
)
50 this->receiver_
->sendc_short_sleep (this->handler_var_
.in ());
53 ACE_Time_Value
tv(10, 0);
56 catch (const CORBA::TIMEOUT
&)
59 "Client received an expected CORBA::TIMEOUT exception.\n"));
61 catch (const CORBA::Exception
& ex
)
63 ex
._tao_print_exception ("(%P|%t) Client_Task - caught exception:");