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
))
28 // The test was designed so that we have to wait here.
33 if (ACE_OS::stat (this->input_
, &st
) == 0 &&
42 ACE_TString infile
= ACE_TString (ACE_TEXT("file://")) + this->input_
;
44 CORBA::Object_var object
=
45 this->corb_
->string_to_object (infile
.c_str ());
47 Bug1495_Regression::Bug1495_var server
=
48 Bug1495_Regression::Bug1495::_narrow (object
.in ());
50 if (CORBA::is_nil (server
.in ()))
53 "Object reference <%s> is nil\n",
59 // Try multiple calls to see if we keep being forwarded
60 for (int i
= 0; i
< 5; ++i
)
62 using Bug1495_Regression::ThreadId
;
64 // call the thread_id function on the test object
65 ThreadId remote_thread_id
;
67 server
->get_thread_id (remote_thread_id
);
70 ACE_TEXT ("Remote thread ID was ")
71 ACE_INT64_FORMAT_SPECIFIER
75 ThreadId
const mythread_id
=
76 ACE_thread_t_to_integer
<ThreadId
> (ACE_Thread::self ());
78 if (mythread_id
!= remote_thread_id
)
81 ACE_TEXT ("ERROR: Failed Bug_1495_Regression test. ")
82 ACE_TEXT ("Expected thread id was ")
83 ACE_INT64_FORMAT_SPECIFIER
84 ACE_TEXT (", received ")
85 ACE_INT64_FORMAT_SPECIFIER
93 ACE_TEXT ("Passed Bug_1495_Regression test.\n")
94 ACE_TEXT ("Local thread id was ")
95 ACE_INT64_FORMAT_SPECIFIER
96 ACE_TEXT (", received ")
97 ACE_INT64_FORMAT_SPECIFIER
104 catch (const CORBA::Exception
& ex
)
106 ex
._tao_print_exception ("Caught exception in client task:");