3 #include "tao/Strategies/advanced_resource.h"
4 #include "tao/Utils/PolicyList_Destroyer.h"
5 #include "tao/Messaging/Messaging.h"
6 #include "tao/AnyTypeCode/Any.h"
7 #include "ace/Get_Opt.h"
9 const ACE_TCHAR
*ior
= ACE_TEXT ("file://middle.ior");
14 usage(ACE_TCHAR
const *cmd
,
18 ACE_TEXT("usage: %s ")
21 ACE_TEXT("-t timeout ")
28 parse_args (int argc
, ACE_TCHAR
*argv
[])
30 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("vk:t:"));
32 ACE_TCHAR
const *stimeout
= 0;
34 while ((c
= get_opts ()) != -1)
42 ior
= get_opts
.opt_arg ();
46 stimeout
= get_opts
.opt_arg();
51 usage(argv
[0], ACE_TEXT("unknown argument"));
58 long tmp
= ACE_OS::strtol(stimeout
, &end
, 10);
59 if (end
== 0 || *end
!= '\0')
61 usage(argv
[0], ACE_TEXT("Invalid timeout value"));
67 // Indicates successful parsing of the command line
72 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
76 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
78 if (parse_args (argc
, argv
) != 0)
81 CORBA::Object_var tmp
= orb
->string_to_object(ior
);
83 // one second in TimeT units
84 TimeBase::TimeT
const second
= 10 * TimeBase::TimeT(1000000);
86 CORBA::Any timeout_as_any
;
87 timeout_as_any
<<= TimeBase::TimeT(timeout
* second
);
89 TAO::Utils::PolicyList_Destroyer
plist(1);
92 orb
->create_policy(Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE
,
95 tmp
= tmp
->_set_policy_overrides(plist
, CORBA::SET_OVERRIDE
);
97 Bug_3647_Regression::Middle_var middle
=
98 Bug_3647_Regression::Middle::_narrow(tmp
.in ());
100 if (CORBA::is_nil (middle
.in ()))
102 ACE_ERROR_RETURN ((LM_DEBUG
,
103 "client(%P|%t) - nil "
104 "Bug_3647_Regression::Middle reference <%s>\n",
109 // Startup the tests ...
110 middle
->startup_test();
112 ACE_DEBUG ((LM_DEBUG
, "client(%P|%t) - test started up\n"));
114 int const iterations
= 10000;
115 int const interval
= iterations
/ 20;
116 ACE_DEBUG ((LM_DEBUG
, "client(%P|%t) - running pings"));
117 for (int i
= 0; i
!= iterations
; ++i
)
120 if (i
% interval
== 0 && i
> 0)
122 ACE_DEBUG((LM_DEBUG
, "."));
125 ACE_DEBUG ((LM_DEBUG
, "done\n"));
128 ACE_DEBUG ((LM_DEBUG
,
129 "client(%P|%t) - server shutdown request sent\n"));
133 catch (const CORBA::Exception
& ex
)
135 ACE_DEBUG ((LM_DEBUG
,
137 ex
._tao_print_exception ("Exception caught:");