2 #include "tao/Messaging/Messaging.h"
3 #include "tao/AnyTypeCode/Any.h"
4 #include "Client_Task.h"
7 Client_Task::Client_Task (const ACE_TCHAR
*ior
,
9 Client_Task::ClientSyncModeEnum syncMode
,
10 ACE_Thread_Manager
*thr_mgr
)
11 : ACE_Task_Base (thr_mgr
)
13 , corb_ (CORBA::ORB::_duplicate (corb
))
14 , syncMode_ (syncMode
)
20 Client_Task::svc (void)
24 CORBA::Object_var tmp
=
25 this->corb_
->string_to_object (input_
);
27 Test::Hello_var hello
=
28 Test::Hello::_narrow(tmp
.in ());
30 if (CORBA::is_nil (hello
.in ()))
32 ACE_ERROR_RETURN ((LM_DEBUG
,
33 "Nil Test::Hello reference <%s>\n",
38 Test::Hello_var tmpVar
= hello
;
41 Messaging::SyncScope selectedScope
= Messaging::SYNC_NONE
; // default
43 if(syncMode_
== Client_Task::MODE_TRANSPORT
) {
44 selectedScope
= Messaging::SYNC_WITH_TRANSPORT
;
45 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - SYNC_WITH_TRANSPORT collocated oneway test\n"));
47 else if(syncMode_
== Client_Task::MODE_SERVER
) {
48 selectedScope
= Messaging::SYNC_WITH_SERVER
;
49 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - SYNC_WITH_SERVER collocated oneway test\n"));
51 else if(syncMode_
== Client_Task::MODE_TARGET
) {
52 selectedScope
= Messaging::SYNC_WITH_TARGET
;
53 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - SYNC_WITH_TARGET collocated oneway test\n"));
55 else if(syncMode_
== Client_Task::MODE_NONE
) {
56 selectedScope
= Messaging::SYNC_NONE
;
57 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - SYNC_NONE collocated oneway test\n"));
60 anyPolicy
<<= selectedScope
;
61 CORBA::PolicyList polList
;
63 polList
[0] = this->corb_
->create_policy(
64 Messaging::SYNC_SCOPE_POLICY_TYPE
, anyPolicy
);
66 CORBA::Object_var tmpGenericVar
=
67 tmpVar
->_set_policy_overrides(polList
,CORBA::ADD_OVERRIDE
);
69 // do unchecked narrow because ORB's not activated. Otherwise get TRANSIENT exception
70 hello
= Test::Hello::_narrow(tmpGenericVar
.in());
72 if (CORBA::is_nil (hello
.in ()))
74 ACE_ERROR_RETURN ((LM_DEBUG
,
75 "Nil Test::Hello reference <%s>\n",
80 CORBA::String_var the_string
=
83 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - string returned <%C>\n",
88 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) - returned from onewayTest() call\n"));
92 catch (const CORBA::Exception
& ex
)
94 ex
._tao_print_exception ("Exception caught:");