summaryrefslogtreecommitdiff
path: root/TAO/tests/Collocation_Oneway_Tests/Hello.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tests/Collocation_Oneway_Tests/Hello.cpp')
-rw-r--r--TAO/tests/Collocation_Oneway_Tests/Hello.cpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/TAO/tests/Collocation_Oneway_Tests/Hello.cpp b/TAO/tests/Collocation_Oneway_Tests/Hello.cpp
new file mode 100644
index 00000000000..6a3b92b19eb
--- /dev/null
+++ b/TAO/tests/Collocation_Oneway_Tests/Hello.cpp
@@ -0,0 +1,72 @@
+//
+// $Id$
+//
+#include "Hello.h"
+#include "tao/ORB_Core.h"
+#include "tao/ORB_Table.h"
+
+ACE_RCSID(Collocation_Oneway_Tests, Hello, "$Id$")
+
+ Hello::Hello (CORBA::ORB_ptr orb,
+ ACE_thread_t thrid)
+ : orb_ (CORBA::ORB::_duplicate (orb))
+ , thr_id_ (thrid)
+{
+}
+
+void
+Hello::onewayTest (void)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) onewayTest() Upcall in process ..\n"));
+ return;
+}
+
+
+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 ();
+
+ if (orb_table->find ("server_orb") == 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)
+{
+ this->orb_->shutdown (0);
+}