diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-10-03 21:02:32 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-10-03 21:02:32 +0000 |
commit | 4dcca24c609008f9fe8a4e01966702b8f4c08e61 (patch) | |
tree | 6bf00b87749636ef3ea7ec22a9b13d4dd2597378 /tests/Bug_2241_Regression/Hello.cpp | |
parent | 8c7cc4d18ddf28a18a01fef53aaea68422b2fff2 (diff) | |
download | ATCD-4dcca24c609008f9fe8a4e01966702b8f4c08e61.tar.gz |
Merged version 94552 from main trunk into this branchalt_mapping_SAIC
Diffstat (limited to 'tests/Bug_2241_Regression/Hello.cpp')
-rw-r--r-- | tests/Bug_2241_Regression/Hello.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/Bug_2241_Regression/Hello.cpp b/tests/Bug_2241_Regression/Hello.cpp new file mode 100644 index 00000000000..cabcd9145d9 --- /dev/null +++ b/tests/Bug_2241_Regression/Hello.cpp @@ -0,0 +1,67 @@ +// +// $Id$ +// +#include "Hello.h" +#include "tao/ORB_Core.h" +#include "tao/ORB_Table.h" +#include "tao/ORB_Core_Auto_Ptr.h" + + Hello::Hello (CORBA::ORB_ptr orb, + ACE_thread_t thrid) + : orb_ (CORBA::ORB::_duplicate (orb)) + , thr_id_ (thrid) +{ +} + +char * +Hello::get_string (void) +{ + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) Upcall in process ..\n")); + + // Use portable thread IDs + ACE_Thread_ID self_ID; + ACE_Thread_ID this_ID; + this_ID.id(this->thr_id_); + + if (self_ID == this_ID) + { + if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation ()) + { + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: A remote call has been made " + " exiting ..\n")); + ACE_OS::abort (); + } + else if (this->orb_->orb_core ()->optimize_collocation_objects () && + this->orb_->orb_core ()->use_global_collocation () == 0) + { + TAO::ORB_Table * const orb_table = + TAO::ORB_Table::instance (); + + TAO_ORB_Core_Auto_Ptr tmp (orb_table->find ("server_orb")); + if (tmp.get () == 0) + { + // We are running on a single ORB and this is an error. + ACE_ERROR ((LM_ERROR, + "(%P|%t) ERROR: A remote call has been made " + " with a single ORB " + " exiting ..\n")); + ACE_OS::abort (); + } + } + } + + return CORBA::string_dup ("Hello there!"); +} + +void +Hello::shutdown (void) +{ + // Give the client thread time to return from the collocated + // call to this method before shutting down the ORB. We sleep + // to avoid BAD_INV_ORDER exceptions on fast dual processor machines. + ACE_OS::sleep (1); + this->orb_->shutdown (0); +} |