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
,
8 : orb_ (CORBA::ORB::_duplicate (orb
))
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 ())
33 "(%P|%t) OK: A remote call has been made \n"));
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.
46 "(%P|%t) ERROR: A remote call has been made "
55 if (this->orb_
->orb_core ()->optimize_collocation_objects () &&
56 this->orb_
->orb_core ()->use_global_collocation ())
59 "(%P|%t) ERROR: An unexpected collocated call has been made \n"));
62 return CORBA::string_dup ("Hello there!");
68 // Give the client thread time to return from the collocated
69 // call to this method before shutting down the ORB. We sleep
70 // to avoid BAD_INV_ORDER exceptions on fast dual processor machines.
72 this->orb_
->shutdown (false);