2 #include "ORB_Holder.h"
3 #include "Servant_var.h"
4 #include "RIR_Narrow.h"
5 #include "RTServer_Setup.h"
8 #include "tao/PortableServer/PortableServer.h"
9 #include "tao/RTPortableServer/RTPortableServer.h"
10 #include "tao/Strategies/advanced_resource.h"
11 #include "tao/Messaging/Messaging.h"
12 #include "ace/Get_Opt.h"
13 #include "ace/Auto_Ptr.h"
15 const ACE_TCHAR
*ior_output_file
= ACE_TEXT ("test.ior");
16 int iterations
= 10000;
19 int do_dump_history
= 0;
23 parse_args (int argc
, ACE_TCHAR
*argv
[])
25 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("o:i:p:n:rd"));
28 while ((c
= get_opts ()) != -1)
32 ior_output_file
= get_opts
.opt_arg ();
36 nthreads
= ACE_OS::atoi (get_opts
.opt_arg ());
40 iterations
= ACE_OS::atoi (get_opts
.opt_arg ());
44 peer_count
= ACE_OS::atoi (get_opts
.opt_arg ());
57 ACE_ERROR_RETURN ((LM_ERROR
,
64 "-d (dump full history) "
69 // Indicates successful parsing of the command line
73 int ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
79 ORB_Holder
orb (argc
, argv
, "");
81 if (parse_args (argc
, argv
) != 0)
84 RTServer_Setup
rtserver_setup (use_rt_corba
,
89 PortableServer::POA_var root_poa
=
90 RIR_Narrow
<PortableServer::POA
>::resolve (orb
,
93 PortableServer::POAManager_var poa_manager
=
94 root_poa
->the_POAManager ();
96 poa_manager
->activate ();
98 PortableServer::POA_var
control_poa (rtserver_setup
.poa ());
99 Servant_var
<Control
> control_impl (
100 new Control (peer_count
,
107 Federated_Test::Control_var control
=
108 control_impl
->_this ();
110 CORBA::String_var ior
=
111 orb
->object_to_string (control
.in ());
113 // Output the ior to the <ior_output_file>
114 FILE *output_file
= ACE_OS::fopen (ior_output_file
, "w");
115 if (output_file
== 0)
116 ACE_ERROR_RETURN ((LM_ERROR
,
117 "Cannot open output file for writing IOR: %s",
120 ACE_OS::fprintf (output_file
, "%s", ior
.in ());
121 ACE_OS::fclose (output_file
);
123 poa_manager
->activate ();
127 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) server - event loop finished\n"));
129 catch (const CORBA::Exception
& ex
)
131 ex
._tao_print_exception ("Exception caught:");