3 #include "ace/Get_Opt.h"
5 const ACE_TCHAR
*ior
= ACE_TEXT("file://test.ior");
7 test_var global_client
;
9 bool server_shutdown
= true;
13 parse_args (int argc
, ACE_TCHAR
*argv
[])
15 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:c:x"));
18 while ((c
= get_opts ()) != -1)
22 ior
= get_opts
.opt_arg ();
25 n_tasks
= ACE_OS::atoi (get_opts
.opt_arg ());
28 server_shutdown
= false;
32 ACE_ERROR_RETURN ((LM_ERROR
,
35 "[-x] [-c concurrent_tasks]"
40 // Indicates successful parsing of the command line
45 class Client
: public ACE_Task_Base
49 Client (test_ptr server
);
57 Client::Client (test_ptr server
)
58 : server_ (test::_duplicate (server
))
67 this->server_
->test_method();
69 catch (const CORBA::Exception
& ex
)
71 ex
._tao_print_exception ("Client: exception raised");
77 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
81 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
83 if (parse_args (argc
, argv
) != 0)
86 CORBA::Object_var obj
= orb
->string_to_object(ior
);
87 test_var server
= test::_narrow(obj
.in ());
88 if (CORBA::is_nil(server
.in ()))
90 ACE_ERROR_RETURN ((LM_DEBUG
,
91 "Nil reference <%s>\n",
96 Client
client (server
.in ());
97 if (client
.activate (THR_NEW_LWP
| THR_JOINABLE
,
99 ACE_ERROR_RETURN ((LM_ERROR
,
100 "Cannot activate client threads\n"),
103 client
.thr_mgr ()->wait ();
112 catch (const CORBA::Exception
& ex
)
114 ex
._tao_print_exception ("Exception caught");