summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2005-06-01 08:19:54 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2005-06-01 08:19:54 +0000
commit82ea55ed98bb21785d911c175eccbe903dea9bc0 (patch)
tree29c5421eb93de905a744f5b3c3317c8a95cb8d9e
parent5727f39d53a025a00614a16827a56b6a60f4d922 (diff)
downloadATCD-82ea55ed98bb21785d911c175eccbe903dea9bc0.tar.gz
ChangeLogTag: Wed Jun 1 07:10:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl>
-rw-r--r--TAO/tao/PortableServer/Root_POA.cpp26
-rw-r--r--TAO/tests/POA/Identity/Identity.cpp50
2 files changed, 49 insertions, 27 deletions
diff --git a/TAO/tao/PortableServer/Root_POA.cpp b/TAO/tao/PortableServer/Root_POA.cpp
index 4db41da113f..4ef9c3e887d 100644
--- a/TAO/tao/PortableServer/Root_POA.cpp
+++ b/TAO/tao/PortableServer/Root_POA.cpp
@@ -1634,8 +1634,30 @@ TAO_Root_POA::id_to_servant_i (const PortableServer::ObjectId &id
PortableServer::POA::ObjectNotActive,
PortableServer::POA::WrongPolicy))
{
- return this->active_policy_strategies_.request_processing_strategy()->
- id_to_servant (id ACE_ENV_ARG_PARAMETER);
+
+ PortableServer::Servant servant =
+ this->active_policy_strategies_.request_processing_strategy()->
+ id_to_servant (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;
}
PortableServer::Servant
diff --git a/TAO/tests/POA/Identity/Identity.cpp b/TAO/tests/POA/Identity/Identity.cpp
index e13fb2f7333..1f3265ec6c4 100644
--- a/TAO/tests/POA/Identity/Identity.cpp
+++ b/TAO/tests/POA/Identity/Identity.cpp
@@ -170,18 +170,18 @@ test_poas (CORBA::ORB_ptr orb,
ACE_DEBUG ((LM_DEBUG, "%s\n", string.in ()));
- PortableServer::Servant servant_from_reference =
+ PortableServer::ServantBase_var servant_from_reference =
root_poa->reference_to_servant (obj.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- PortableServer::Servant servant_from_id =
+ PortableServer::ServantBase_var servant_from_id =
root_poa->id_to_servant (id.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- if (servant_from_reference != servant_from_id
- || servant_from_reference != &servant)
+ if (servant_from_reference.in () != servant_from_id.in ()
+ || servant_from_reference.in () != &servant)
{
ACE_ERROR ((LM_ERROR,
"Mismatched servant_from_reference, "
@@ -228,7 +228,7 @@ test_poas (CORBA::ORB_ptr orb,
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- ACE_ASSERT (servant_from_reference == &servant);
+ ACE_ASSERT (servant_from_reference.in () == &servant);
root_poa->deactivate_object (id.in ()
ACE_ENV_ARG_PARAMETER);
@@ -301,18 +301,18 @@ test_poas (CORBA::ORB_ptr orb,
ACE_DEBUG ((LM_DEBUG, "%s\n", string.in ()));
- PortableServer::Servant servant_from_reference =
+ PortableServer::ServantBase_var servant_from_reference =
first_poa->reference_to_servant (obj.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- PortableServer::Servant servant_from_id =
+ PortableServer::ServantBase_var servant_from_id =
first_poa->id_to_servant (id.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- if (servant_from_reference != servant_from_id
- || servant_from_reference != &servant)
+ if (servant_from_reference .in () != servant_from_id.in ()
+ || servant_from_reference.in () != &servant)
{
ACE_ERROR ((LM_ERROR,
"Mismatched servant_from_reference, "
@@ -334,7 +334,7 @@ test_poas (CORBA::ORB_ptr orb,
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- ACE_ASSERT (servant_from_reference == &servant);
+ ACE_ASSERT (servant_from_reference.in () == &servant);
first_poa->deactivate_object (id.in ()
ACE_ENV_ARG_PARAMETER);
@@ -407,18 +407,18 @@ test_poas (CORBA::ORB_ptr orb,
ACE_DEBUG ((LM_DEBUG, "%s\n", string.in ()));
- PortableServer::Servant servant_from_reference =
+ PortableServer::ServantBase_var servant_from_reference =
second_poa->reference_to_servant (obj.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- PortableServer::Servant servant_from_id =
+ PortableServer::ServantBase_var servant_from_id =
second_poa->id_to_servant (id.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- if (servant_from_reference != servant_from_id
- || servant_from_reference != &servant)
+ if (servant_from_reference.in () != servant_from_id.in ()
+ || servant_from_reference.in () != &servant)
{
ACE_ERROR ((LM_ERROR,
"Mismatched servant_from_reference, "
@@ -465,7 +465,7 @@ test_poas (CORBA::ORB_ptr orb,
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- ACE_ASSERT (servant_from_reference == &servant);
+ ACE_ASSERT (servant_from_reference.in () == &servant);
second_poa->deactivate_object (id.in ()
ACE_ENV_ARG_PARAMETER);
@@ -545,18 +545,18 @@ test_poas (CORBA::ORB_ptr orb,
ACE_DEBUG ((LM_DEBUG, "%s\n", string.in ()));
- PortableServer::Servant servant_from_reference =
+ PortableServer::ServantBase_var servant_from_reference =
third_poa->reference_to_servant (obj.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- PortableServer::Servant servant_from_id =
+ PortableServer::ServantBase_var servant_from_id =
third_poa->id_to_servant (id.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- if (servant_from_reference != servant_from_id
- || servant_from_reference != &servant)
+ if (servant_from_reference.in () != servant_from_id.in ()
+ || servant_from_reference.in () != &servant)
{
ACE_ERROR ((LM_ERROR,
"Mismatched servant_from_reference, "
@@ -606,7 +606,7 @@ test_poas (CORBA::ORB_ptr orb,
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- ACE_ASSERT (servant_from_reference == &servant);
+ ACE_ASSERT (servant_from_reference.in () == &servant);
third_poa->deactivate_object (id.in ()
ACE_ENV_ARG_PARAMETER);
@@ -653,18 +653,18 @@ test_poas (CORBA::ORB_ptr orb,
ACE_DEBUG ((LM_DEBUG, "%s\n", string.in ()));
- PortableServer::Servant servant_from_reference =
+ PortableServer::ServantBase_var servant_from_reference =
forth_poa->reference_to_servant (obj.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- PortableServer::Servant servant_from_id =
+ PortableServer::ServantBase_var servant_from_id =
forth_poa->id_to_servant (id.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- if (servant_from_reference != servant_from_id
- || servant_from_reference != &servant)
+ if (servant_from_reference.in () != servant_from_id.in ()
+ || servant_from_reference.in () != &servant)
{
ACE_ERROR ((LM_ERROR,
"Mismatched servant_from_reference, "
@@ -684,7 +684,7 @@ test_poas (CORBA::ORB_ptr orb,
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
- ACE_ASSERT (servant_from_reference == &servant);
+ ACE_ASSERT (servant_from_reference.in () == &servant);
forth_poa->deactivate_object (id.in ()
ACE_ENV_ARG_PARAMETER);