=default for generated implementation copy ctor
[ACE_TAO.git] / TAO / tests / Collocated_Best / Collocated_Best_ThuP / Hello.cpp
blob7c37d42b72eeb46706e5dce6db819b22f0545405
1 #include "Hello.h"
2 #include "tao/ORB_Core.h"
3 #include "tao/ORB_Table.h"
4 #include "tao/ORB_Core_Auto_Ptr.h"
5 #include "./tao/Collocation_Strategy.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 ()
17 ACE_DEBUG ((LM_DEBUG,
18 "(%P|%t) Upcall in process ..\n"));
20 // Use portable thread IDs
21 ACE_Thread_ID self_ID;
22 ACE_Thread_ID this_ID;
23 this_ID.id(this->thr_id_);
25 if (self_ID == this_ID)
27 if (this->orb_->orb_core ()->optimize_collocation_objects () &&
28 this->orb_->orb_core ()->use_global_collocation ())
30 ACE_ERROR ((LM_ERROR,
31 "(%P|%t) ERROR: A remote call has been made "
32 " exiting ..\n"));
33 ACE_OS::abort ();
35 else if (this->orb_->orb_core ()->optimize_collocation_objects () &&
36 this->orb_->orb_core ()->use_global_collocation () == 0)
38 TAO::ORB_Table * const orb_table =
39 TAO::ORB_Table::instance ();
41 TAO_ORB_Core_Auto_Ptr tmp (orb_table->find ("server_orb"));
42 if (tmp.get () == nullptr)
44 // We are running on a single ORB and this is an error.
45 ACE_ERROR ((LM_ERROR,
46 "(%P|%t) ERROR: A remote call has been made "
47 " with a single ORB "
48 " exiting ..\n"));
49 ACE_OS::abort ();
54 return CORBA::string_dup ("Hello there!");
57 void
58 Hello::shutdown ()
60 // Give the client thread time to return from the collocated
61 // call to this method before shutting down the ORB. We sleep
62 // to avoid BAD_INV_ORDER exceptions on fast dual processor machines.
63 ACE_OS::sleep (1);
64 this->orb_->shutdown (false);