2 #include "ace/Get_Opt.h"
5 static const ACE_TCHAR
*ior
= ACE_TEXT ("file://test.ior");
8 static int shutdown_server
= 0;
9 // Flag to tell server to shutdown.
11 static CORBA::UShort call_count
= 5;
12 // # of nested calls to be made.
15 // The test is quiet...
17 static int number_of_threads
= 1;
18 // Number of client threads.
23 Client_Task (client_ptr c
,
32 Client_Task::Client_Task (client_ptr c
,
34 : client_ (client::_duplicate (c
)),
35 server_ (server::_duplicate (s
))
40 Client_Task::svc (void)
46 "(%t) Client_Task::svc calling start -> time to live = %d\n",
49 // Now, we can invoke an operation on the remote side.
50 this->server_
->start (this->client_
.in (),
55 catch (const CORBA::Exception
& ex
)
57 ex
._tao_print_exception ("Client_Task::svc");
64 parse_args (int argc
, ACE_TCHAR
**argv
)
66 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("qxn:k:t:"));
69 while ((c
= get_opts ()) != -1)
81 call_count
= ACE_OS::atoi (get_opts
.opt_arg ());
85 number_of_threads
= ACE_OS::atoi (get_opts
.opt_arg ());
89 ior
= get_opts
.opt_arg ();
94 ACE_ERROR_RETURN ((LM_ERROR
,
96 " [-n number of nested calls]"
99 " [-x (shutdown server)]"
106 ACE_ERROR_RETURN ((LM_ERROR
,
107 "%s: no nested up calls server ior specified\n",
111 // Indicates successful parsing of command line.
116 ACT_TMAIN (int argc
, ACE_TCHAR
**argv
)
120 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
122 int result
= parse_args (argc
, argv
);
126 CORBA::Object_var object
= orb
->resolve_initial_references ("RootPOA");
128 PortableServer::POA_var root_poa
=
129 PortableServer::POA::_narrow (object
.in ());
131 PortableServer::POAManager_var poa_manager
=
132 root_poa
->the_POAManager ();
134 poa_manager
->activate ();
136 object
= orb
->string_to_object (ior
);
138 server_var server
= server::_narrow (object
.in ());
140 // Create an client object to hand to the other side...
141 client_i
client_servant (quiet
,
144 PortableServer::ObjectId_var id
=
145 root_poa
->activate_object (&client_servant
);
147 CORBA::Object_var object_act
= root_poa
->id_to_reference (id
.in ());
149 client_var client_object
= client::_narrow (object_act
.in ());
151 Client_Task
client_tasks (client_object
.in (),
162 root_poa
->destroy (1,
165 catch (const CORBA::Exception
& ex
)
167 ex
._tao_print_exception ("client::main");