2 #include "ace/Get_Opt.h"
3 #include "ace/OS_NS_unistd.h"
4 #include "tao/Strategies/advanced_resource.h"
6 const ACE_TCHAR
*ior
= ACE_TEXT("server.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)
47 for(int i
= 0; !done
; i
++)
50 ACE_TString
iorfile(ior
);
52 ACE_OS::sprintf (number
, ACE_TEXT(".%d"), i
);
55 if (ACE_OS::access(iorfile
.c_str (), R_OK
) == 0)
57 iorfile
= ACE_TEXT("file://") + iorfile
;
58 CORBA::Object_var tmp
=
59 orb
->string_to_object(iorfile
.c_str ());
62 test::_narrow(tmp
.in ());
64 if (CORBA::is_nil (test
.in ()))
66 ACE_ERROR_RETURN ((LM_DEBUG
,
67 "Nil test reference <%s>\n",
72 test
->send_stuff ("Some stuff to send");
74 // Test for LFU strategy. The transport to any other
75 // server should be removed before the first one.
78 test
->send_stuff ("Some stuff to send");
82 else if (i
== 5) // let a few go by before we reuse holder
83 { // This will test the LRU strategy
84 // This transport should be the 6th one
86 if (!CORBA::is_nil(holder
.in ()))
88 holder
->send_stuff ("Some stuff to send");
102 catch (const CORBA::Exception
& ex
)
104 ex
._tao_print_exception ("Exception caught:");