Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tests / Collocation_Exception_Test / Hello.cpp
blobd4816a90d7405b412f9ee404cdcf80b8c41f4d23
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::system_exception_test ()
16 throw CORBA::INTERNAL ();
19 void
20 Hello::user_exception_expected ()
22 throw ::Test::Hello::A ();
25 void
26 Hello::user_exception_not_expected ()
28 this->throw_internal_b ();
31 void
32 Hello::throw_internal_b ()
34 throw ::Test::Hello::B ();
37 char *
38 Hello::get_string ()
40 ACE_DEBUG ((LM_DEBUG,
41 "(%P|%t) Upcall in process ..\n"));
43 // Use portable thread IDs
44 ACE_Thread_ID self_ID;
45 ACE_Thread_ID this_ID;
46 this_ID.id(this->thr_id_);
48 if (self_ID == this_ID)
50 if (this->orb_->orb_core ()->optimize_collocation_objects () &&
51 this->orb_->orb_core ()->use_global_collocation ())
53 ACE_ERROR ((LM_ERROR,
54 "(%P|%t) ERROR: A remote call has been made "
55 " exiting ..\n"));
56 ACE_OS::abort ();
58 else if (this->orb_->orb_core ()->optimize_collocation_objects () &&
59 this->orb_->orb_core ()->use_global_collocation () == 0)
61 TAO::ORB_Table * const orb_table =
62 TAO::ORB_Table::instance ();
64 TAO_ORB_Core_Auto_Ptr tmp (orb_table->find ("server_orb"));
65 if (tmp.get () == nullptr)
67 // We are running on a single ORB and this is an error.
68 ACE_ERROR ((LM_ERROR,
69 "(%P|%t) ERROR: A remote call has been made "
70 " with a single ORB "
71 " exiting ..\n"));
72 ACE_OS::abort ();
77 return CORBA::string_dup ("Hello there!");
80 void
81 Hello::shutdown ()
83 this->orb_->shutdown (false);