2 #include "Client_Task.h"
3 #include "ace/Get_Opt.h"
4 #include "tao/AnyTypeCode/Any.h"
6 const ACE_TCHAR
*ior
= ACE_TEXT("file://test.ior");
9 parse_args (int argc
, ACE_TCHAR
*argv
[])
11 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:"));
14 while ((c
= get_opts ()) != -1)
18 ior
= get_opts
.opt_arg ();
23 ACE_ERROR_RETURN ((LM_ERROR
,
30 // Indicates successful parsing of the command line
35 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
40 CORBA::ORB_init (argc
, argv
);
42 if (parse_args (argc
, argv
) != 0)
45 CORBA::Object_var tmp
=
46 orb
->string_to_object(ior
);
48 Test::Hello_var hello
=
49 Test::Hello::_narrow(tmp
.in ());
51 if (CORBA::is_nil (hello
.in ()))
53 ACE_ERROR_RETURN ((LM_DEBUG
,
54 "Nil Test::Hello reference <%s>\n",
59 CORBA::Object_var poa_object
=
60 orb
->resolve_initial_references("RootPOA");
62 PortableServer::POA_var root_poa
=
63 PortableServer::POA::_narrow (poa_object
.in ());
65 PortableServer::POAManager_var poa_manager
=
66 root_poa
->the_POAManager ();
68 poa_manager
->activate ();
70 CORBA::Object_var object
=
71 orb
->resolve_initial_references ("PolicyCurrent");
72 CORBA::PolicyCurrent_var policy_current
=
73 CORBA::PolicyCurrent::_narrow (object
.in ());
75 TimeBase::TimeT timeout_period
= 10 * 1000;
77 CORBA::Any timeout_as_any
;
78 timeout_as_any
<<= timeout_period
;
80 CORBA::PolicyList
policy_list (1);
81 policy_list
.length (1);
83 orb
->create_policy (Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE
,
86 policy_current
->set_policy_overrides (policy_list
,
90 // Let the client perform the test in a separate thread
91 Client_Task
client (hello
.in (),
93 ACE_Thread_Manager::instance ());
95 if (client
.activate (THR_NEW_LWP
| THR_JOINABLE
,
97 ACE_ERROR_RETURN ((LM_ERROR
,
98 "Cannot activate client threads\n"),
101 client
.thr_mgr ()->wait ();
103 root_poa
->destroy (1, // ethernalize objects
104 0 // wait for completion
109 catch (const CORBA::Exception
& ex
)
111 ex
._tao_print_exception ("Exception caught:");