summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2005-05-27 08:47:43 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2005-05-27 08:47:43 +0000
commitc084054a9ca908a6bd882d964dfb33a99c035645 (patch)
tree27e73b265b3a3cee37665482bb3cb51dd4c5457b
parent08feaa26f70a247e3f7a1c1a577b0c5f6873092a (diff)
downloadATCD-c084054a9ca908a6bd882d964dfb33a99c035645.tar.gz
ChangeLogTag: Fri May 27 08:36:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl>
-rw-r--r--TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.cpp14
-rw-r--r--TAO/tao/PortableServer/Root_POA.cpp25
-rw-r--r--TAO/tests/POA/Deactivate_Object/server.cpp9
-rw-r--r--TAO/tests/POA/Default_Servant/Default_Servant.cpp8
4 files changed, 35 insertions, 21 deletions
diff --git a/TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.cpp b/TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.cpp
index 4a016b7fb03..e02b1194e52 100644
--- a/TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.cpp
+++ b/TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.cpp
@@ -170,20 +170,6 @@ namespace TAO
if (servant != 0)
{
- // ATTENTION: Trick locking here, see class header for details
- Non_Servant_Upcall non_servant_upcall (*this->poa_);
- ACE_UNUSED_ARG (non_servant_upcall);
-
- // The POA invokes _add_ref once on the Servant before returning
- // it. If the application uses reference counting, the caller of
- // id_to_servant is responsible for invoking _remove_ref once on
- // the returned Servant when it is finished with it. A
- // conforming caller need not invoke _remove_ref on the returned
- // Servant if the type of the Servant uses the default reference
- // counting inherited from ServantBase.
- servant->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
return servant;
}
else
diff --git a/TAO/tao/PortableServer/Root_POA.cpp b/TAO/tao/PortableServer/Root_POA.cpp
index 0d1c9a88860..4db41da113f 100644
--- a/TAO/tao/PortableServer/Root_POA.cpp
+++ b/TAO/tao/PortableServer/Root_POA.cpp
@@ -1500,8 +1500,29 @@ TAO_Root_POA::reference_to_servant_i (CORBA::Object_ptr reference
0);
}
- return this->active_policy_strategies_.request_processing_strategy()->
- system_id_to_servant (system_id ACE_ENV_ARG_PARAMETER);
+ PortableServer::Servant servant =
+ this->active_policy_strategies_.request_processing_strategy()->
+ system_id_to_servant (system_id ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (servant != 0)
+ {
+ // ATTENTION: Trick locking here, see class header for details
+ TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (*this);
+ ACE_UNUSED_ARG (non_servant_upcall);
+
+ // The POA invokes _add_ref once on the Servant before returning
+ // it. If the application uses reference counting, the caller of
+ // id_to_servant is responsible for invoking _remove_ref once on
+ // the returned Servant when it is finished with it. A
+ // conforming caller need not invoke _remove_ref on the returned
+ // Servant if the type of the Servant uses the default reference
+ // counting inherited from ServantBase.
+ servant->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ }
+
+ return servant;
}
bool
diff --git a/TAO/tests/POA/Deactivate_Object/server.cpp b/TAO/tests/POA/Deactivate_Object/server.cpp
index b722e1ffd53..13749603e33 100644
--- a/TAO/tests/POA/Deactivate_Object/server.cpp
+++ b/TAO/tests/POA/Deactivate_Object/server.cpp
@@ -52,6 +52,15 @@ main (int argc, char *argv[])
PortableServer::ObjectId_var new_obj_id = root_poa->reference_to_id (obj_var.in () ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
+ // Invoke reference_to_servant(). Should retrieve servant.
+ PortableServer::ServantBase_var servant =
+ root_poa->reference_to_servant (obj_var.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Assert correctness.
+ ACE_ASSERT (hello_impl == servant.in());
+
root_poa->deactivate_object (new_obj_id.in () ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
}
diff --git a/TAO/tests/POA/Default_Servant/Default_Servant.cpp b/TAO/tests/POA/Default_Servant/Default_Servant.cpp
index 0a2afd5ce86..307114546e3 100644
--- a/TAO/tests/POA/Default_Servant/Default_Servant.cpp
+++ b/TAO/tests/POA/Default_Servant/Default_Servant.cpp
@@ -212,16 +212,14 @@ main (int argc, char **argv)
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
- PortableServer::Servant servant = 0;
-
// Invoke id_to_servant(). Should retrieve default servant.
- servant =
+ PortableServer::ServantBase_var servant =
default_servant_poa->id_to_servant (id.in ()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
// Assert correctness.
- ACE_ASSERT (&test == servant);
+ ACE_ASSERT (&test == servant.in());
// Invoke reference_to_servant(). Should retrieve default servant.
servant =
@@ -230,7 +228,7 @@ main (int argc, char **argv)
ACE_TRY_CHECK;
// Assert correctness.
- ACE_ASSERT (&test == servant);
+ ACE_ASSERT (&test == servant.in());
// Report success.
ACE_DEBUG ((LM_DEBUG,