1 #include "ace/Get_Opt.h"
3 #include "ace/OS_NS_string.h"
6 const ACE_TCHAR
*ior
= ACE_TEXT("file://test.ior");
11 parse_args (int argc
, ACE_TCHAR
*argv
[])
13 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("xk:n:"));
16 while ((c
= get_opts ()) != -1)
24 ior
= get_opts
.opt_arg ();
28 nthreads
= ACE_OS::atoi (get_opts
.opt_arg ());
33 ACE_ERROR_RETURN ((LM_ERROR
,
36 "[-n <nthreads> | -x]"
41 // Indicates successful parsing of the command line
47 const char *twohundredbytes
=
48 "12345678901234567890123456789012345678901234567890"
49 "12345678901234567890123456789012345678901234567890"
50 "12345678901234567890123456789012345678901234567890"
51 "12345678901234567890123456789012345678901234567890"
55 struct Worker
: ACE_Task_Base
57 Worker (Simple_Server_ptr srv
)
58 : srv_(Simple_Server::_duplicate(srv
))
62 Simple_Server_var srv_
;
66 CORBA::String_var str
= CORBA::string_alloc (200*2000 + 1);
67 if (str
.in () == 0) return 1;
68 str
.inout ()[0] = CORBA::Char ('\0');
69 for (int i
=0; i
< 2000; ++i
)
71 ACE_OS::strcat (str
.inout (), twohundredbytes
);
78 CORBA::String_var ret
= srv_
->test_method (str
.in ());
79 if (0 != ACE_OS::strcmp (str
.in (), ret
.in ())) return 1;
81 catch (const CORBA::Exception
& ex
)
84 ACE_TEXT ("(%P|%t) Exception caught: \n%C\n"),
85 ex
._info ().c_str ()));
94 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
98 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
100 if (parse_args (argc
, argv
) != 0)
103 CORBA::Object_var object
= orb
->string_to_object (ior
);
105 Simple_Server_var server
= Simple_Server::_narrow (object
.in ());
107 if (CORBA::is_nil (server
.in ()))
109 ACE_ERROR_RETURN ((LM_ERROR
,
110 "Object reference <%s> is nil.\n",
120 Worker
wrk (server
.in ());
121 wrk
.activate (THR_NEW_LWP
|THR_JOINABLE
|THR_INHERIT_SCHED
, nthreads
);
122 wrk
.thr_mgr ()->wait ();
125 catch (const CORBA::Exception
& ex
)
127 ACE_DEBUG ((LM_ERROR
, ACE_TEXT ("(%P|%t) ERROR: Exception caught: \n%C\n"),
128 ex
._info ().c_str ()));