2 * @file Client_Task.cpp
3 * @author Will Otte <wotte@dre.vanderbilt.edu
5 * Implements the Client_Task class defined in Client_Task.h.
8 #include "Client_Task.h"
10 #include "Client_ORBInitializer.h"
11 #include "tid_to_int.h"
12 #include "ace/OS_NS_unistd.h"
13 #include "ace/OS_NS_sys_stat.h"
15 Client_Task::Client_Task (const ACE_TCHAR
*input
,
17 ACE_Thread_Manager
*thr_mgr
)
18 : ACE_Task_Base (thr_mgr
),
20 corb_ (CORBA::ORB::_duplicate (corb
))
25 Client_Task::svc (void)
29 // The test was designed so that we have to wait here.
34 if (ACE_OS::stat (this->input_
, &st
) == 0 &&
43 ACE_TString infile
= ACE_TString (ACE_TEXT("file://")) + this->input_
;
45 CORBA::Object_var object
=
46 this->corb_
->string_to_object (infile
.c_str ());
48 Bug1495_Regression::Bug1495_var server
=
49 Bug1495_Regression::Bug1495::_narrow (object
.in ());
51 if (CORBA::is_nil (server
.in ()))
54 "Object reference <%s> is nil\n",
60 // Try multiple calls to see if we keep being forwarded
61 for (int i
= 0; i
< 5; ++i
)
63 using Bug1495_Regression::ThreadId
;
65 // call the thread_id function on the test object
66 ThreadId remote_thread_id
;
68 server
->get_thread_id (remote_thread_id
);
71 ACE_TEXT ("Remote thread ID was ")
72 ACE_INT64_FORMAT_SPECIFIER
76 ThreadId
const mythread_id
=
77 ACE_thread_t_to_integer
<ThreadId
> (ACE_Thread::self ());
79 if (mythread_id
!= remote_thread_id
)
82 ACE_TEXT ("ERROR: Failed Bug_1495_Regression test. ")
83 ACE_TEXT ("Expected thread id was ")
84 ACE_INT64_FORMAT_SPECIFIER
85 ACE_TEXT (", received ")
86 ACE_INT64_FORMAT_SPECIFIER
94 ACE_TEXT ("Passed Bug_1495_Regression test.\n")
95 ACE_TEXT ("Local thread id was ")
96 ACE_INT64_FORMAT_SPECIFIER
97 ACE_TEXT (", received ")
98 ACE_INT64_FORMAT_SPECIFIER
105 catch (const CORBA::Exception
& ex
)
107 ex
._tao_print_exception ("Caught exception in client task:");