2 #include "ace/Get_Opt.h"
3 #include "ace/High_Res_Timer.h"
4 #include "tao/ORB_Core.h"
6 const ACE_TCHAR
*ior
= ACE_TEXT("file://test.ior");
8 bool sanity_timeout
= false;
10 void hook (TAO_ORB_Core
*,
15 ACE_DEBUG ((LM_DEBUG
, "Timeout hook called\n"));
21 parse_args (int argc
, ACE_TCHAR
*argv
[])
23 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:xt"));
26 while ((c
= get_opts ()) != -1)
30 ior
= get_opts
.opt_arg ();
36 sanity_timeout
= true;
40 ACE_ERROR_RETURN ((LM_ERROR
,
48 // Indicates successful parsing of the command line
53 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
58 CORBA::ORB_init (argc
, argv
);
60 if (parse_args (argc
, argv
) != 0)
65 ACE_DEBUG ((LM_DEBUG
, "Installing sanity timeout\n"));
66 orb
->orb_core ()->connection_timeout_hook (hook
);
69 CORBA::Object_var tmp
=
70 orb
->string_to_object(ior
);
72 ACE_High_Res_Timer hrt
;
75 ACE_DEBUG ((LM_DEBUG
,"Narrowing IOR - "));
78 Test::Hello_var hello
=
79 Test::Hello::_narrow(tmp
.in ());
81 hrt
.elapsed_microseconds (elapsed
);
85 ACE_TEXT("call completed in %d usec\n"),
88 if (CORBA::is_nil (hello
.in ()))
90 ACE_ERROR_RETURN ((LM_DEBUG
,
91 "Nil Test::Hello reference <%s>\n",
101 ACE_DEBUG ((LM_DEBUG
,"Starting invocation 1 - "));
103 CORBA::String_var the_string
=
104 hello
->get_string ();
106 hrt
.elapsed_microseconds (elapsed
);
107 ACE_DEBUG ((LM_DEBUG
,
108 ACE_TEXT("call completed in %d usec\n"),
110 ACE_DEBUG ((LM_DEBUG
,"Starting invocation 2 - "));
113 the_string
= hello
->get_string ();
115 hrt
.elapsed_microseconds (elapsed
);
116 ACE_DEBUG ((LM_DEBUG
,
117 ACE_TEXT("call completed in %d usec\n"),
122 catch (const CORBA::Exception
& ex
)
124 ex
._tao_print_exception ("Exception caught:");