=default for generated implementation copy ctor
[ACE_TAO.git] / TAO / tests / Collocated_Best / Collocated_Best_Direct / Hello.cpp
blob33e94c85f01b56dd5f28de5bbfe1fabe78510909
1 #include "Hello.h"
2 #include "tao/ORB_Core.h"
3 #include "tao/ORB_Table.h"
4 #include "tao/ORB_Core_Auto_Ptr.h"
6 Hello::Hello (CORBA::ORB_ptr orb,
7 ACE_thread_t thrid)
8 : orb_ (CORBA::ORB::_duplicate (orb))
9 , thr_id_ (thrid)
13 char *
14 Hello::get_string ()
16 ACE_DEBUG ((LM_DEBUG,
17 "(%P|%t) Upcall in process ..\n"));
19 // Use portable thread IDs
20 ACE_Thread_ID self_ID;
21 // Thread ID from Server
22 ACE_Thread_ID this_ID;
23 this_ID.id(this->thr_id_);
25 // Servant Thread ID same as Thread ID server, so a remote call,
26 // in case of a collocation the servant runs in calling thread (Client)
27 if (self_ID == this_ID)
29 if (this->orb_->orb_core ()->optimize_collocation_objects () &&
30 this->orb_->orb_core ()->use_global_collocation ())
32 ACE_ERROR ((LM_ERROR,
33 "(%P|%t) ERROR: A remote call has been made "
34 " exiting ..\n"));
35 ACE_OS::abort ();
37 else if (this->orb_->orb_core ()->optimize_collocation_objects () &&
38 this->orb_->orb_core ()->use_global_collocation () == 0)
40 TAO::ORB_Table * const orb_table =
41 TAO::ORB_Table::instance ();
43 TAO_ORB_Core_Auto_Ptr tmp (orb_table->find ("server_orb"));
44 if (tmp.get () == nullptr)
46 // We are running on a single ORB and this is an error.
47 ACE_ERROR ((LM_ERROR,
48 "(%P|%t) ERROR: A remote call has been made "
49 " with a single ORB "
50 " exiting ..\n"));
51 ACE_OS::abort ();
56 return CORBA::string_dup ("Hello there!");
59 void
60 Hello::shutdown ()
62 // Give the client thread time to return from the collocated
63 // call to this method before shutting down the ORB. We sleep
64 // to avoid BAD_INV_ORDER exceptions on fast dual processor machines.
65 ACE_OS::sleep (1);
66 this->orb_->shutdown (false);