Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / Bug_2084_Regression / Hello.cpp
blobaf049b27ecc03b3fba81ce2a4ecfae00bd924608
1 #include "Hello.h"
2 #include "tid_to_int.h"
3 #include "tao/ORB_Core.h"
4 #include "tao/ORB_Table.h"
5 #include "tao/ORB_Core_Auto_Ptr.h"
7 Hello::Hello (CORBA::ORB_ptr orb)
8 : orb_ (CORBA::ORB::_duplicate (orb))
12 char *
13 Hello::get_string (::Test::ThreadId caller_threadid)
15 ACE_DEBUG ((LM_DEBUG,
16 "(%P|%t) Upcall in process ..\n"));
18 if (ACE_thread_t_to_integer< ::Test::ThreadId> (ACE_Thread::self ()) != caller_threadid)
20 // this means a remote call was made
22 if (this->orb_->orb_core ()->optimize_collocation_objects () &&
23 this->orb_->orb_core ()->use_global_collocation ())
25 ACE_ERROR ((LM_ERROR,
26 "(%P|%t) ERROR: A remote call has been made "
27 " exiting ..\n"));
28 ACE_OS::abort ();
30 else if (this->orb_->orb_core ()->optimize_collocation_objects () &&
31 this->orb_->orb_core ()->use_global_collocation () == 0)
33 TAO::ORB_Table * const orb_table =
34 TAO::ORB_Table::instance ();
36 TAO_ORB_Core_Auto_Ptr tmp (orb_table->find ("server_orb"));
37 if (tmp.get () == nullptr)
39 // We are running on a single ORB and this is an error.
40 ACE_ERROR ((LM_ERROR,
41 "(%P|%t) ERROR: A remote call has been made "
42 " with a single ORB "
43 " exiting ..\n"));
44 ACE_OS::abort ();
49 return CORBA::string_dup ("Hello there!");
52 void
53 Hello::shutdown ()
55 // Give the client thread time to return from the collocated
56 // call to this method before shutting down the ORB. We sleep
57 // to avoid BAD_INV_ORDER exceptions on fast dual processor machines.
58 ACE_OS::sleep (1);
59 this->orb_->shutdown (false);