Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tests / Collocation_Oneway_Tests / Hello.cpp
blobe417c604473989df87195394cb2daa5925c465d0
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 void
14 Hello::onewayTest ()
16 ACE_DEBUG ((LM_DEBUG,
17 "(%P|%t) onewayTest() Upcall in process ..\n"));
21 char *
22 Hello::get_string ()
24 ACE_DEBUG ((LM_DEBUG,
25 "(%P|%t) Upcall in process ..\n"));
27 // Use portable thread IDs
28 ACE_Thread_ID self_ID;
29 ACE_Thread_ID this_ID;
30 this_ID.id(this->thr_id_);
32 if (self_ID == this_ID)
34 if (this->orb_->orb_core ()->optimize_collocation_objects () &&
35 this->orb_->orb_core ()->use_global_collocation ())
37 ACE_ERROR ((LM_ERROR,
38 "(%P|%t) ERROR: A remote call has been made "
39 " exiting ..\n"));
40 ACE_OS::abort ();
42 else if (this->orb_->orb_core ()->optimize_collocation_objects () &&
43 this->orb_->orb_core ()->use_global_collocation () == 0)
45 TAO::ORB_Table * const orb_table =
46 TAO::ORB_Table::instance ();
48 TAO_ORB_Core_Auto_Ptr tmp (orb_table->find ("server_orb"));
49 if (tmp.get () == nullptr)
51 // We are running on a single ORB and this is an error.
52 ACE_ERROR ((LM_ERROR,
53 "(%P|%t) ERROR: A remote call has been made "
54 " with a single ORB "
55 " exiting ..\n"));
56 ACE_OS::abort ();
61 return CORBA::string_dup ("Hello there!");
64 void
65 Hello::shutdown ()
67 this->orb_->shutdown (false);