More tests update
[ACE_TAO.git] / TAO / tests / Bug_2084_Regression / Hello.cpp
blobcf2be3df7bc799f20a6b8ae23d4bf9397da02714
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 ACE_thread_t thrid)
9 : orb_ (CORBA::ORB::_duplicate (orb))
10 , thr_id_ (thrid)
14 char *
15 Hello::get_string (::Test::ThreadId caller_threadid)
17 ACE_DEBUG ((LM_DEBUG,
18 "(%P|%t) Upcall in process ..\n"));
20 if (ACE_thread_t_to_integer< ::Test::ThreadId> (ACE_Thread::self ()) != caller_threadid)
22 // this means a remote call was made
24 if (this->orb_->orb_core ()->optimize_collocation_objects () &&
25 this->orb_->orb_core ()->use_global_collocation ())
27 ACE_ERROR ((LM_ERROR,
28 "(%P|%t) ERROR: A remote call has been made "
29 " exiting ..\n"));
30 ACE_OS::abort ();
32 else if (this->orb_->orb_core ()->optimize_collocation_objects () &&
33 this->orb_->orb_core ()->use_global_collocation () == 0)
35 TAO::ORB_Table * const orb_table =
36 TAO::ORB_Table::instance ();
38 TAO_ORB_Core_Auto_Ptr tmp (orb_table->find ("server_orb"));
39 if (tmp.get () == 0)
41 // We are running on a single ORB and this is an error.
42 ACE_ERROR ((LM_ERROR,
43 "(%P|%t) ERROR: A remote call has been made "
44 " with a single ORB "
45 " exiting ..\n"));
46 ACE_OS::abort ();
51 return CORBA::string_dup ("Hello there!");
54 void
55 Hello::shutdown (void)
57 // Give the client thread time to return from the collocated
58 // call to this method before shutting down the ORB. We sleep
59 // to avoid BAD_INV_ORDER exceptions on fast dual processor machines.
60 ACE_OS::sleep (1);
61 this->orb_->shutdown (0);