2 #include "Client_Task.h"
3 #include "tao/Messaging/Messaging.h"
4 #include "tao/AnyTypeCode/Any.h"
5 #include "ace/OS_NS_unistd.h"
7 Client_Task::Client_Task (CORBA::ORB_ptr orb
,
8 Test::Sender_ptr reply_gen
,
9 ACE_Thread_Manager
*thr_mgr
,
10 int number_of_oneways
)
11 : ACE_Task_Base (thr_mgr
)
12 , sender_(Test::Sender::_duplicate (reply_gen
))
13 , orb_ (CORBA::ORB::_duplicate (orb
))
14 , number_ (number_of_oneways
)
21 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) Starting client task\n"));
25 // Apply sync_none policy
26 CORBA::Object_var object
=
27 orb_
->resolve_initial_references ("PolicyCurrent");
29 CORBA::PolicyCurrent_var policy_current
=
30 CORBA::PolicyCurrent::_narrow (object
.in ());
32 if (CORBA::is_nil (policy_current
.in ()))
34 ACE_ERROR ((LM_ERROR
, "ERROR: Nil policy current\n"));
37 CORBA::Any scope_as_any
;
38 scope_as_any
<<= Messaging::SYNC_NONE
;
40 CORBA::PolicyList
policies (1); policies
.length (1);
42 orb_
->create_policy (Messaging::SYNC_SCOPE_POLICY_TYPE
,
44 policy_current
->set_policy_overrides (policies
, CORBA::ADD_OVERRIDE
);
46 policies
[0]->destroy ();
48 for (int i
= 0; i
!= number_
; ++i
)
51 "TAO (%P|%t) sending oneway invocation %d...\n", i
));
53 this->sender_
->send_ready_message ();
56 ACE_OS::sleep(ACE_Time_Value(0,250000));
59 catch (const CORBA::Exception
& ex
)
61 ex
._tao_print_exception ("Caught Exception");
64 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) Client task finished\n"));