1 #include "ace/Get_Opt.h"
3 #include "ace/Thread.h"
5 #include "Client_ORBInitializer.h"
6 #include "tao/ORBInitializer_Registry.h"
8 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("ef:"));
16 while ((c
= get_opts ()) != -1)
22 ior
= get_opts
.opt_arg ();
26 ACE_ERROR_RETURN ((LM_ERROR
,
36 static ACE_THR_FUNC_RETURN
run_test(void* pData
)
38 Test_Interceptors::Visual_ptr server
= static_cast<Test_Interceptors::Visual_ptr
>(pData
);
44 catch (const CORBA::Exception
& ex
)
46 ex
._tao_print_exception ("Exception thrown in run_test()\n");
49 return (ACE_THR_FUNC_RETURN
)0;
53 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
57 PortableInterceptor::ORBInitializer_ptr temp_initializer
;
59 ACE_NEW_RETURN (temp_initializer
,
60 Client_ORBInitializer
,
61 -1); // No exceptions yet!
62 PortableInterceptor::ORBInitializer_var initializer
=
65 PortableInterceptor::register_orb_initializer (initializer
.in ());
67 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
69 if (parse_args (argc
, argv
) != 0)
72 CORBA::Object_var object
=
73 orb
->string_to_object (ior
);
75 Test_Interceptors::Visual_var server
=
76 Test_Interceptors::Visual::_narrow (object
.in ());
78 if (CORBA::is_nil (server
.in ()))
80 ACE_ERROR_RETURN ((LM_ERROR
,
81 "Object reference <%s> is nil.\n",
86 ACE_hthread_t threadHandle
;
87 if ( ACE_Thread::spawn(run_test
,
88 static_cast<void*>(server
.in()),
89 THR_NEW_LWP
| THR_JOINABLE
,
91 & threadHandle
) == -1 )
93 ACE_ERROR_RETURN ((LM_ERROR
,"Cannot start thread"), 1);
96 ACE_Thread::join (threadHandle
);
103 catch (const CORBA::Exception
& ex
)
105 ex
._tao_print_exception ("Caught exception in client:");