summaryrefslogtreecommitdiff
path: root/TAO/tests/NestedUpcall/MT_Client_Test/local_server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tests/NestedUpcall/MT_Client_Test/local_server.cpp')
-rw-r--r--TAO/tests/NestedUpcall/MT_Client_Test/local_server.cpp199
1 files changed, 85 insertions, 114 deletions
diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/local_server.cpp b/TAO/tests/NestedUpcall/MT_Client_Test/local_server.cpp
index 0f9543bbb85..2e750d704f0 100644
--- a/TAO/tests/NestedUpcall/MT_Client_Test/local_server.cpp
+++ b/TAO/tests/NestedUpcall/MT_Client_Test/local_server.cpp
@@ -141,75 +141,76 @@ MT_Server::init (int argc,
"MT_Server::init: ORB_Manager is nil!\n"),
-1);
- ACE_DECLARE_NEW_CORBA_ENV;
- ACE_TRY
+ TAO_TRY
+ {
+
+ // Call the init of TAO_ORB_Manager to create a child POA
+ // under the root POA.
+ this->orb_manager_ptr_->init_child_poa (argc,
+ argv,
+ "child_poa",
+ TAO_TRY_ENV);
+
+ TAO_CHECK_ENV;
+
+ this->parse_args ();
+ // ~~ check for the return value here
+
+ CORBA::String_var str =
+ this->orb_manager_ptr_->activate_under_child_poa ("MT",
+ &this->mT_Object_i_,
+ TAO_TRY_ENV);
+ ACE_DEBUG ((LM_DEBUG,
+ "The IOR is: <%s>\n",
+ str.in ()));
+
+ if (this->ior_output_file_)
{
- // Call the init of TAO_ORB_Manager to create a child POA
- // under the root POA.
- this->orb_manager_ptr_->init_child_poa (argc,
- argv,
- "child_poa",
- ACE_TRY_ENV);
-
- ACE_TRY_CHECK;
-
- this->parse_args ();
- // ~~ check for the return value here
-
- this->str_ =
- this->orb_manager_ptr_->activate_under_child_poa ("MT",
- &this->mT_Object_i_,
- ACE_TRY_ENV);
- ACE_DEBUG ((LM_DEBUG,
- "The IOR is: <%s>\n",
- this->str_.in ()));
-
- if (this->ior_output_file_)
- {
- ACE_OS::fprintf (this->ior_output_file_,
- "%s",
- this->str_.in ());
- ACE_OS::fclose (this->ior_output_file_);
- }
-
- // retrieve the object reference to the distant mt object
- if (this->object_key_ == 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "The IOR is nil, not able to get the object.\n"),
- -1);
+ ACE_OS::fprintf (this->ior_output_file_,
+ "%s",
+ str.in ());
+ ACE_OS::fclose (this->ior_output_file_);
+ }
- CORBA::ORB_var orb_var = this->orb_manager_ptr_->orb ();
+ // retrieve the object reference to the distant mt object
+ if (this->object_key_ == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "The IOR is nil, not able to get the object.\n"),
+ -1);
+
+ CORBA::ORB_var orb_var = this->orb_manager_ptr_->orb ();
- CORBA::Object_var object_var =
- orb_var->string_to_object (this->object_key_,
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
+ CORBA::Object_var object_var = orb_var->string_to_object (this->object_key_,
+ TAO_TRY_ENV);
+ TAO_CHECK_ENV;
- if (CORBA::is_nil (object_var.in()))
+ if (CORBA::is_nil (object_var.in()))
ACE_ERROR_RETURN ((LM_ERROR,
"No proper object has been returned.\n"),
-1);
- this->mT_Object_var_ = MT_Object::_narrow (object_var.in(),
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- if (CORBA::is_nil (this->mT_Object_var_.in()))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "We have no proper reference to the Object.\n"),
- -1);
- }
+ this->mT_Object_var_ = MT_Object::_narrow (object_var.in(),
+ TAO_TRY_ENV);
+ TAO_CHECK_ENV;
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG, "We have a proper reference to the Object.\n"));
- }
- ACE_CATCHANY
+ if (CORBA::is_nil (this->mT_Object_var_.in()))
{
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "MT_Client::init");
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "We have no proper reference to the Object.\n"),
+ -1);
}
- ACE_ENDTRY;
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "We have a proper reference to the Object.\n"));
+
+ }
+ TAO_CATCHANY
+ {
+ TAO_TRY_ENV.print_exception ("MT_Client::init");
+ return -1;
+ }
+ TAO_ENDTRY;
+
return 0;
}
@@ -217,23 +218,11 @@ MT_Server::init (int argc,
int
MT_Server::run ()
{
- ACE_DECLARE_NEW_CORBA_ENV;
- ACE_TRY
- {
- int r = this->orb_manager_ptr_->run (ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- if (r == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "MT_Server::run"),
- -1);
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "MT_Server::run");
- return -1;
- }
- ACE_ENDTRY;
+ CORBA::Environment env;
+ if (this->orb_manager_ptr_->run (env) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "MT_Server::run"),
+ -1);
return 0;
}
@@ -241,19 +230,6 @@ MT_Server::~MT_Server (void)
{
if (this->object_key_ != 0)
ACE_OS::free (this->object_key_);
-
- ACE_DECLARE_NEW_CORBA_ENV;
- ACE_TRY
- {
- this->orb_manager_ptr_->deactivate_under_child_poa (this->str_.in (),
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "MT_Client::~MT_Client");
- }
- ACE_ENDTRY;
}
@@ -261,33 +237,28 @@ int
MT_Server::run_ORB_briefly (void)
{
if (this->iterations_ > 0)
+ {
+ CORBA::Environment env;
+
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) MT_Server::run: "
+ "going to call distant MT Object\n"));
+
+ for (unsigned int i = 0; i < this->iterations_; i++)
{
- ACE_DECLARE_NEW_CORBA_ENV;
- ACE_TRY
- {
- ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) MT_Server::run: "
- "going to call distant MT Object\n"));
-
- for (unsigned int i = 0; i < this->iterations_; i++)
- {
- MT_Object_var tmp =
- this->mT_Object_i_._this (ACE_TRY_ENV);
- ACE_TRY_CHECK;
-
- this->mT_Object_var_->yadda (0,
- tmp.in (),
- ACE_TRY_ENV);
- ACE_TRY_CHECK;
- }
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "MT_Server::run_ORB_briefly");
- return -1;
- }
- ACE_ENDTRY;
+ this->mT_Object_var_->yadda (0,
+ this->mT_Object_i_._this (env),
+ env);
+
+ if (env.exception () != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "MT_Server::run: failed to call distant MT object\n"),
+ -1);
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) MT_Server::run: "
+ "called distant MT Object i = %d\n",
+ i));
}
+ }
return 0;
}