summaryrefslogtreecommitdiff
path: root/CIAO/ciao
diff options
context:
space:
mode:
authormcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2011-10-20 09:46:10 +0000
committermcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2011-10-20 09:46:10 +0000
commit02686f8d5108580e8a3d56bfe9b124405fdedd18 (patch)
tree0426ac218b7505e1c06dbf5ff8d2b10144d7ce75 /CIAO/ciao
parentb2334408ebeffc6686b1f976247926df8411caec (diff)
downloadATCD-02686f8d5108580e8a3d56bfe9b124405fdedd18.tar.gz
Tue Oct 20 09:30:13 UTC 2011 Martin Corino <mcorino@remedy.nl>
Merged changes from Remedy work branch.
Diffstat (limited to 'CIAO/ciao')
-rw-r--r--CIAO/ciao/Base/CIAO_Base.mpc1
-rw-r--r--CIAO/ciao/Containers/Container_Base_T.cpp87
-rw-r--r--CIAO/ciao/Containers/Servant_Activator.cpp6
-rw-r--r--CIAO/ciao/Contexts/Context_Impl_Base_T.cpp15
-rw-r--r--CIAO/ciao/Contexts/Session/Session_Context_T.cpp13
-rw-r--r--CIAO/ciao/Deployment/Handlers/CIAO_State.cpp173
-rw-r--r--CIAO/ciao/Deployment/Handlers/CIAO_State.h11
-rw-r--r--CIAO/ciao/Deployment/Handlers/Connection_Handler.cpp79
-rw-r--r--CIAO/ciao/Deployment/Handlers/Connection_Handler.h5
-rw-r--r--CIAO/ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors.mpc6
-rw-r--r--CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.cpp2
-rw-r--r--CIAO/ciao/Servants/Connector_Servant_Impl_Base.cpp78
-rw-r--r--CIAO/ciao/Servants/Extension/Servant_Impl_T.cpp10
-rw-r--r--CIAO/ciao/Servants/Home_Servant_Impl_T.cpp51
-rw-r--r--CIAO/ciao/Servants/Servant_Impl_Base.cpp8
-rw-r--r--CIAO/ciao/Servants/Session/Servant_Impl_T.cpp1
16 files changed, 398 insertions, 148 deletions
diff --git a/CIAO/ciao/Base/CIAO_Base.mpc b/CIAO/ciao/Base/CIAO_Base.mpc
index 581e172d591..6b4b0bb86f5 100644
--- a/CIAO/ciao/Base/CIAO_Base.mpc
+++ b/CIAO/ciao/Base/CIAO_Base.mpc
@@ -36,6 +36,7 @@ project(CIAO_Base_stub) : install, ciaolib_with_idl, ciao_output, \
}
Header_Files {
CIAO_PropertiesC.h
+ CIAO_ExceptionsC.h
Server_init.h
Client_init.h
CIAO_Base_stub_export.h
diff --git a/CIAO/ciao/Containers/Container_Base_T.cpp b/CIAO/ciao/Containers/Container_Base_T.cpp
index 3f1d3e05498..81d912fe430 100644
--- a/CIAO/ciao/Containers/Container_Base_T.cpp
+++ b/CIAO/ciao/Containers/Container_Base_T.cpp
@@ -33,16 +33,19 @@ namespace CIAO
{
this->sa_ = ::CIAO::Servant_Activator::_nil ();
- if (! CORBA::is_nil (this->component_poa_.in ()))
+ ::PortableServer::POA_var comp_poa_safe = this->component_poa_._retn ();
+
+ if (! CORBA::is_nil (comp_poa_safe.in ()))
{
- this->component_poa_->destroy (1, 1);
- this->component_poa_ = ::PortableServer::POA::_nil ();
+ comp_poa_safe->destroy (1, 1);
}
- if (! CORBA::is_nil (this->facet_cons_poa_.in ()))
+ ::PortableServer::POA_var facet_cons_poa_safe =
+ this->facet_cons_poa_._retn ();
+
+ if (! CORBA::is_nil (facet_cons_poa_safe.in ()))
{
- this->facet_cons_poa_->destroy (1, 1);
- this->facet_cons_poa_ = ::PortableServer::POA::_nil ();
+ facet_cons_poa_safe->destroy (1, 1);
}
this->root_poa_ = ::PortableServer::POA::_nil ();
@@ -92,20 +95,20 @@ namespace CIAO
{
CIAO_TRACE ("Container_i::install_servant");
- PortableServer::POA_ptr tmp = PortableServer::POA::_nil();
+ PortableServer::POA_var poa_safe;
if (t == Container_Types::COMPONENT_t ||
t == Container_Types::HOME_t)
{
- tmp = this->component_poa_.in ();
+ poa_safe = PortableServer::POA::_duplicate(this->component_poa_.in ());
}
else
{
- tmp = this->facet_cons_poa_.in ();
+ poa_safe = PortableServer::POA::_duplicate(this->facet_cons_poa_.in ());
}
- PortableServer::ObjectId_var tmp_id = tmp->activate_object (p);
- CORBA::Object_var objref = tmp->id_to_reference (tmp_id.in ());
+ PortableServer::ObjectId_var tmp_id = poa_safe->activate_object (p);
+ CORBA::Object_var objref = poa_safe->id_to_reference (tmp_id.in ());
oid = tmp_id._retn ();
return objref._retn ();
@@ -118,19 +121,22 @@ namespace CIAO
{
CIAO_TRACE ("Container_i::uninstall");
- PortableServer::ServantBase_var svnt;
+ PortableServer::POA_var poa_safe;
switch (y)
{
case Container_Types::COMPONENT_t:
case Container_Types::HOME_t:
- svnt = this->component_poa_->reference_to_servant (objref);
+ poa_safe = PortableServer::POA::_duplicate(this->component_poa_.in());
break;
default:
- svnt = this->facet_cons_poa_->reference_to_servant (objref);
+ poa_safe = PortableServer::POA::_duplicate(this->facet_cons_poa_.in());
break;
}
+ PortableServer::ServantBase_var svnt =
+ poa_safe->reference_to_servant (objref);
+
PortableServer::ObjectId_var oid;
this->uninstall_servant (svnt.in (), y, oid.out ());
}
@@ -317,8 +323,10 @@ namespace CIAO
{
CIAO_TRACE ("Container_i::uninstall_component");
+ PortableServer::POA_var poa_safe =
+ PortableServer::POA::_duplicate(this->component_poa_.in ());
PortableServer::ServantBase_var srv_tmp =
- this->component_poa_->reference_to_servant (homeref);
+ poa_safe->reference_to_servant (homeref);
CIAO::Connector_Servant_Impl_Base * svnt =
dynamic_cast <CIAO::Connector_Servant_Impl_Base *> (
srv_tmp.in ());
@@ -348,7 +356,7 @@ namespace CIAO
{
CIAO_TRACE ("Container_i::uninstall_servant");
- PortableServer::POA_ptr tmp = PortableServer::POA::_nil();
+ PortableServer::POA_var poa_safe;
if ((t == Container_Types::COMPONENT_t) ||
(t == Container_Types::HOME_t))
@@ -359,7 +367,7 @@ namespace CIAO
"Container_i::uninstall_servant - "
"Removing component or home servant\n"));
- tmp = this->component_poa_.in ();
+ poa_safe = PortableServer::POA::_duplicate(this->component_poa_.in ());
}
else
{
@@ -369,13 +377,13 @@ namespace CIAO
"Container_i::uninstall_servant - "
"Removing facet or consumer servant\n"));
- tmp = this->facet_cons_poa_.in ();
+ poa_safe = PortableServer::POA::_duplicate(this->facet_cons_poa_.in ());
}
try
{
- PortableServer::ObjectId_var tmp_id = tmp->servant_to_id (svnt);
- tmp->deactivate_object (tmp_id);
+ PortableServer::ObjectId_var tmp_id = poa_safe->servant_to_id (svnt);
+ poa_safe->deactivate_object (tmp_id);
CIAO_DEBUG (9,
(LM_TRACE,
@@ -410,14 +418,15 @@ namespace CIAO
try
{
-
+ PortableServer::POA_var poa_safe =
+ PortableServer::POA::_duplicate(this->component_poa_.in ());
CIAO::Connector_Servant_Impl_Base * svt = 0;
PortableServer::ServantBase_var servant_from_reference;
try
{
servant_from_reference =
- this->component_poa_->reference_to_servant (compref);
+ poa_safe->reference_to_servant (compref);
svt =
dynamic_cast<CIAO::Connector_Servant_Impl_Base *> (
servant_from_reference.in ());
@@ -488,13 +497,15 @@ namespace CIAO
try
{
+ PortableServer::POA_var poa_safe =
+ PortableServer::POA::_duplicate(this->component_poa_.in ());
CIAO::Connector_Servant_Impl_Base * svt = 0;
PortableServer::ServantBase_var servant_from_reference;
try
{
servant_from_reference =
- this->component_poa_->reference_to_servant (compref);
+ poa_safe->reference_to_servant (compref);
svt =
dynamic_cast<CIAO::Connector_Servant_Impl_Base *> (
servant_from_reference.in ());
@@ -561,7 +572,9 @@ namespace CIAO
try
{
- svt = this->component_poa_->reference_to_servant (compref);
+ PortableServer::POA_var poa_safe =
+ PortableServer::POA::_duplicate(this->component_poa_.in ());
+ svt = poa_safe->reference_to_servant (compref);
}
catch (CORBA::Exception &ex)
{
@@ -587,7 +600,7 @@ namespace CIAO
"exception while retrieving servant.");
}
- if (!svt)
+ if (CORBA::is_nil (svt.in ()))
{
CIAO_ERROR (1, (LM_EMERGENCY, CLINFO
"Container_i::set_attributes - %C\n"
@@ -794,10 +807,12 @@ namespace CIAO
throw ::Components::InvalidConnection ();
}
+ PortableServer::POA_var poa_safe =
+ PortableServer::POA::_duplicate(this->component_poa_.in ());
try
{
PortableServer::ServantBase_var provider_tmp =
- this->component_poa_->reference_to_servant (provider);
+ poa_safe->reference_to_servant (provider);
CIAO_DEBUG (9,
(LM_TRACE,
@@ -822,7 +837,7 @@ namespace CIAO
}
PortableServer::ServantBase_var user_tmp =
- this->component_poa_->reference_to_servant (user);
+ poa_safe->reference_to_servant (user);
CIAO_DEBUG (9, (LM_TRACE, CLINFO "Container_i::connect_local_facet - "
"Successfully fetched user servant [%C] from POA\n", user_port));
@@ -933,8 +948,10 @@ namespace CIAO
try
{
+ PortableServer::POA_var poa_safe =
+ PortableServer::POA::_duplicate(this->component_poa_.in ());
PortableServer::ServantBase_var srv_tmp =
- this->component_poa_->reference_to_servant (provider);
+ poa_safe->reference_to_servant (provider);
CIAO_DEBUG (9,
(LM_TRACE,
@@ -957,7 +974,7 @@ namespace CIAO
throw ::Components::InvalidConnection ();
}
- srv_tmp = this->component_poa_->reference_to_servant (user);
+ srv_tmp = poa_safe->reference_to_servant (user);
CIAO_DEBUG (9,
(LM_TRACE,
@@ -1039,7 +1056,9 @@ namespace CIAO
::CORBA::Object_ptr
Container_i<BASE>::get_objref (PortableServer::Servant p)
{
- return this->component_poa_->servant_to_reference (p);
+ PortableServer::POA_var poa_safe =
+ PortableServer::POA::_duplicate(this->component_poa_.in ());
+ return poa_safe->servant_to_reference (p);
}
template <typename BASE>
@@ -1057,16 +1076,16 @@ namespace CIAO
{
CIAO_TRACE ("Container_i::generate_reference");
- PortableServer::POA_ptr tmp = PortableServer::POA::_nil();
+ PortableServer::POA_var poa_safe;
if (t == Container_Types::COMPONENT_t
|| t == Container_Types::HOME_t)
{
- tmp = this->component_poa_.in ();
+ poa_safe = PortableServer::POA::_duplicate(this->component_poa_.in ());
}
else
{
- tmp = this->facet_cons_poa_.in ();
+ poa_safe = PortableServer::POA::_duplicate(this->facet_cons_poa_.in ());
}
PortableServer::ObjectId_var oid =
@@ -1076,7 +1095,7 @@ namespace CIAO
PortableServer::ObjectId_to_string (oid.in ());
CORBA::Object_var objref =
- tmp->create_reference_with_id (oid.in (), repo_id);
+ poa_safe->create_reference_with_id (oid.in (), repo_id);
return objref._retn ();
}
diff --git a/CIAO/ciao/Containers/Servant_Activator.cpp b/CIAO/ciao/Containers/Servant_Activator.cpp
index 7da2a332b71..4b37f61cb06 100644
--- a/CIAO/ciao/Containers/Servant_Activator.cpp
+++ b/CIAO/ciao/Containers/Servant_Activator.cpp
@@ -84,7 +84,7 @@ namespace CIAO
throw CORBA::OBJECT_NOT_EXIST ();
}
- if (CORBA::is_nil (pa_iter->second))
+ if (CORBA::is_nil (pa_iter->second.in ()))
{
CIAO_ERROR (1, (LM_ERROR, CLINFO "Servant_Activator_i::incarnate - "
"Port Activator for ObjectId %C was nil!\n",
@@ -133,7 +133,7 @@ namespace CIAO
throw CORBA::OBJECT_NOT_EXIST ();
}
- if (CORBA::is_nil (pa_iter->second))
+ if (CORBA::is_nil (pa_iter->second.in ()))
{
CIAO_ERROR (1, (LM_ERROR, CLINFO "Servant_Activator_i::etherealize - "
"Port Activator for ObjectId %C was nil!\n",
@@ -151,7 +151,7 @@ namespace CIAO
guard,
this->mutex_,
false);
- CORBA::String_var safe_oid (pa->oid ());
+ ::CORBA::String_var safe_oid (pa->oid ());
::CORBA::String_var safe_name (pa->name ());
CIAO_DEBUG (6, (LM_INFO, CLINFO "Servant_Activator_i::register_port_activator - "
"Registering a port activator for port [%C] with ObjectID [%C]\n",
diff --git a/CIAO/ciao/Contexts/Context_Impl_Base_T.cpp b/CIAO/ciao/Contexts/Context_Impl_Base_T.cpp
index 4654d054eae..5cdb617d469 100644
--- a/CIAO/ciao/Contexts/Context_Impl_Base_T.cpp
+++ b/CIAO/ciao/Contexts/Context_Impl_Base_T.cpp
@@ -3,6 +3,8 @@
#ifndef CIAO_CONTEXT_IMPL_BASE_T_C
#define CIAO_CONTEXT_IMPL_BASE_T_C
+#include "ciao/Logger/Log_Macros.h"
+
namespace CIAO
{
template <typename CONTAINER_TYPE>
@@ -78,7 +80,18 @@ namespace CIAO
CORBA::Object_ptr
Context_Impl_Base_T<CONTAINER_TYPE>::resolve_service_reference(const char *service_id)
{
- return this->container_->resolve_service_reference (service_id);
+ typename CONTAINER_TYPE::_var_type cnt_safe =
+ CONTAINER_TYPE::_duplicate (this->container_.in ());
+ if (::CORBA::is_nil (cnt_safe.in ()))
+ {
+ CIAO_ERROR (1,
+ (LM_ERROR,
+ CLINFO
+ "Extension_Context_Impl::get_client_interceptor_registration - "
+ "Error: Container is nil\n"));
+ throw ::CORBA::INV_OBJREF ();
+ }
+ return cnt_safe->resolve_service_reference (service_id);
}
template <typename CONTAINER_TYPE>
diff --git a/CIAO/ciao/Contexts/Session/Session_Context_T.cpp b/CIAO/ciao/Contexts/Session/Session_Context_T.cpp
index 36d5c7914ab..a54bbe60263 100644
--- a/CIAO/ciao/Contexts/Session/Session_Context_T.cpp
+++ b/CIAO/ciao/Contexts/Session/Session_Context_T.cpp
@@ -32,7 +32,18 @@ namespace CIAO
try
{
- obj = this->container_->get_objref (this->servant_);
+ ::CIAO::Session_Container_var cnt_safe =
+ ::CIAO::Session_Container::_duplicate (this->container_.in ());
+ if (::CORBA::is_nil (cnt_safe.in ()))
+ {
+ CIAO_ERROR (1,
+ (LM_ERROR,
+ CLINFO
+ "Session_Context_Impl::get_CCM_object - "
+ "Error: Container is nil\n"));
+ throw ::CORBA::INV_OBJREF ();
+ }
+ obj = cnt_safe->get_objref (this->servant_);
}
catch (const CORBA::Exception& ex)
{
diff --git a/CIAO/ciao/Deployment/Handlers/CIAO_State.cpp b/CIAO/ciao/Deployment/Handlers/CIAO_State.cpp
index 97c58878251..cad4f3049a5 100644
--- a/CIAO/ciao/Deployment/Handlers/CIAO_State.cpp
+++ b/CIAO/ciao/Deployment/Handlers/CIAO_State.cpp
@@ -20,6 +20,11 @@ namespace CIAO
{
CIAO_TRACE ("Deployment_State::add_container");
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->container_mutex_,
+ CORBA::NO_RESOURCES ());
+
if (CIAO_debug_level && // Let's only perform this lookup if we have logging enabled.
this->containers_.find (id) != this->containers_.end ())
{
@@ -35,6 +40,12 @@ namespace CIAO
Deployment_State::remove_container (const char *id)
{
CIAO_TRACE ("Deployment_State::remove_container");
+
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->container_mutex_,
+ CORBA::NO_RESOURCES ());
+
CONTAINERS::iterator pos = this->containers_.find (id);
if (pos != this->containers_.end ())
@@ -46,12 +57,15 @@ namespace CIAO
{
CIAO_TRACE ("Deployment_State::fetch_container");
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->container_mutex_,
+ CORBA::NO_RESOURCES ());
+
CONTAINERS::iterator pos = this->containers_.find (id);
if (pos == this->containers_.end ())
- {
- return CIAO::Container::_nil ();
- }
+ return CIAO::Container::_nil ();
return CIAO::Container::_duplicate (pos->second.in ());
}
@@ -63,33 +77,58 @@ namespace CIAO
{
CIAO_TRACE ("Deployment_State::add_home");
- if (CIAO_debug_level && // Let's only perform this lookup if we have logging enabled.
- this->homes_.find (id) != this->homes_.end ())
- {
- CIAO_ERROR (1, (LM_WARNING, CLINFO
- "Deployment_State::add_home - "
- "Warning: Attempting to add duplicate home reference\n"));
- }
-
- this->instance_container_[id] = cont_id;
- this->homes_[id] = Components::CCMHome::_duplicate (home);
+ {
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->home_mutex_,
+ CORBA::NO_RESOURCES ());
+
+ if (CIAO_debug_level && // Let's only perform this lookup if we have logging enabled.
+ this->homes_.find (id) != this->homes_.end ())
+ {
+ CIAO_ERROR (1, (LM_WARNING, CLINFO
+ "Deployment_State::add_home - "
+ "Warning: Attempting to add duplicate home reference\n"));
+ }
+ this->homes_[id] = Components::CCMHome::_duplicate (home);
+ }
+
+ {
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->instance_container_mutex_,
+ CORBA::NO_RESOURCES ());
+ this->instance_container_[id] = cont_id;
+ }
}
void
Deployment_State::remove_home (const char *id)
{
CIAO_TRACE ("Deployment_State::remove_home");
-
- HOMES::iterator pos = this->homes_.find (id);
-
- if (pos != this->homes_.end ())
- this->homes_.erase (pos);
-
- INSTANCE_CONTAINER::iterator cont =
- this->instance_container_.find (id);
-
- if (cont != this->instance_container_.end ())
- this->instance_container_.erase (cont);
+ {
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->home_mutex_,
+ CORBA::NO_RESOURCES ());
+
+ HOMES::iterator pos = this->homes_.find (id);
+
+ if (pos != this->homes_.end ())
+ this->homes_.erase (pos);
+ }
+
+ {
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->instance_container_mutex_,
+ CORBA::NO_RESOURCES ());
+ INSTANCE_CONTAINER::iterator cont =
+ this->instance_container_.find (id);
+
+ if (cont != this->instance_container_.end ())
+ this->instance_container_.erase (cont);
+ }
}
Components::CCMHome_ptr
@@ -97,9 +136,16 @@ namespace CIAO
{
CIAO_TRACE ("Deployment_State::fetch_home");
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->home_mutex_,
+ CORBA::NO_RESOURCES ());
+
HOMES::iterator pos = this->homes_.find (id);
- if (pos == this->homes_.end ()) return Components::CCMHome::_nil ();
+ if (pos == this->homes_.end ())
+ return Components::CCMHome::_nil ();
+
return Components::CCMHome::_duplicate (pos->second.in ());
}
@@ -110,16 +156,28 @@ namespace CIAO
{
CIAO_TRACE ("Deployment_State::add_component");
- if (CIAO_debug_level && // Let's only perform this lookup if we have logging enabled.
- this->components_.find (id) != this->components_.end ())
- {
- CIAO_ERROR (1, (LM_WARNING, CLINFO
- "Deployment_State::add_component - "
- "Warning: Attempting to add duplicate component reference\n"));
- }
-
- this->instance_container_[id] = cont_id;
- this->components_[id] = Components::CCMObject::_duplicate (component);
+ {
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->component_mutex_,
+ CORBA::NO_RESOURCES ());
+
+ if (CIAO_debug_level && // Let's only perform this lookup if we have logging enabled.
+ this->components_.find (id) != this->components_.end ())
+ {
+ CIAO_ERROR (1, (LM_WARNING, CLINFO
+ "Deployment_State::add_component - "
+ "Warning: Attempting to add duplicate component reference\n"));
+ }
+ this->components_[id] = Components::CCMObject::_duplicate (component);
+ }
+ {
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->instance_container_mutex_,
+ CORBA::NO_RESOURCES ());
+ this->instance_container_[id] = cont_id;
+ }
}
void
@@ -127,16 +185,28 @@ namespace CIAO
{
CIAO_TRACE ("Deployment_State::remove_component");
- COMPONENTS::iterator pos = this->components_.find (id);
-
- if (pos != this->components_.end ())
- this->components_.erase (pos);
-
- INSTANCE_CONTAINER::iterator cont =
- this->instance_container_.find (id);
-
- if (cont != this->instance_container_.end ())
- this->instance_container_.erase (cont);
+ {
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->component_mutex_,
+ CORBA::NO_RESOURCES ());
+ COMPONENTS::iterator pos = this->components_.find (id);
+
+ if (pos != this->components_.end ())
+ this->components_.erase (pos);
+ }
+
+ {
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->instance_container_mutex_,
+ CORBA::NO_RESOURCES ());
+ INSTANCE_CONTAINER::iterator cont =
+ this->instance_container_.find (id);
+
+ if (cont != this->instance_container_.end ())
+ this->instance_container_.erase (cont);
+ }
}
Components::CCMObject_ptr
@@ -144,12 +214,15 @@ namespace CIAO
{
CIAO_TRACE ("Deployment_State::fetch_component");
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->component_mutex_,
+ CORBA::NO_RESOURCES ());
+
COMPONENTS::iterator pos = this->components_.find (id);
if (pos == this->components_.end ())
- {
- return Components::CCMObject::_nil ();
- }
+ return Components::CCMObject::_nil ();
return Components::CCMObject::_duplicate (pos->second.in ());
}
@@ -159,6 +232,10 @@ namespace CIAO
{
CIAO_TRACE ("Deployment_State::instance_to_container");
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->instance_container_mutex_,
+ CORBA::NO_RESOURCES ());
INSTANCE_CONTAINER::const_iterator cont =
this->instance_container_.find (id);
diff --git a/CIAO/ciao/Deployment/Handlers/CIAO_State.h b/CIAO/ciao/Deployment/Handlers/CIAO_State.h
index cb1d81f7ba3..a63a3c90dd1 100644
--- a/CIAO/ciao/Deployment/Handlers/CIAO_State.h
+++ b/CIAO/ciao/Deployment/Handlers/CIAO_State.h
@@ -56,25 +56,36 @@ namespace CIAO
Connection_Handler connection_handler;
private:
+ /// Container administration
typedef std::map < std::string,
CIAO::Container_var > CONTAINERS;
CONTAINERS containers_;
+ TAO_SYNCH_MUTEX container_mutex_;
+
typedef std::map < std::string, std::string > INSTANCE_CONTAINER;
/// maps instance ids to containers.
INSTANCE_CONTAINER instance_container_;
+ TAO_SYNCH_MUTEX instance_container_mutex_;
+
+ /// Homes administration
typedef std::map < std::string,
Components::CCMHome_var > HOMES;
HOMES homes_;
+ TAO_SYNCH_MUTEX home_mutex_;
+
+ /// Components administration
typedef std::map < std::string,
Components::CCMObject_var > COMPONENTS;
COMPONENTS components_;
+
+ TAO_SYNCH_MUTEX component_mutex_;
};
typedef ACE_Singleton <Deployment_State,
diff --git a/CIAO/ciao/Deployment/Handlers/Connection_Handler.cpp b/CIAO/ciao/Deployment/Handlers/Connection_Handler.cpp
index 2e5c0a2e614..a2efc2e6d76 100644
--- a/CIAO/ciao/Deployment/Handlers/Connection_Handler.cpp
+++ b/CIAO/ciao/Deployment/Handlers/Connection_Handler.cpp
@@ -276,7 +276,7 @@ namespace CIAO
}
else
{
- //only because of the receptacle is an external endpoint
+ //only because the receptacle is an external endpoint
this->disconnect_non_local (conn, conn.externalReference[0].portName.in ());
}
break;
@@ -320,7 +320,7 @@ namespace CIAO
// pass through
throw;
}
- // Since DANCE shutdown the Locality managers simultaniously,
+ // Since DANCE shuts down the Locality managers simultaniously,
// it could be that one locality manager is shutdown while the
// other wants to disconnect from this locality manager. Therefor
// we catch an OBJECT_NOT_EXIST, TRANSIENT and a COMM_FAILURE at this point
@@ -436,6 +436,10 @@ namespace CIAO
::Components::Cookie_var cookie = provided->connect (conn.externalReference[0].portName.in (),
facet.in ());
+#if defined (CIAO_PRE_ESTABLISH_CONNECTIONS)
+ this->validate_connection(conn.name.in (), facet.in ());
+#endif
+
CIAO_DEBUG (5, (LM_INFO, CLINFO
"Connection_Handler::connect_non_local_facet - "
"Connection <%C> successfully established.\n",
@@ -509,6 +513,10 @@ namespace CIAO
::Components::Cookie_var cookie = receptacle->connect (endpoint.portName.in (),
provided.in ());
+#if defined (CIAO_PRE_ESTABLISH_CONNECTIONS)
+ this->validate_connection(conn.name.in (), provided.in ());
+#endif
+
CIAO_DEBUG (5, (LM_INFO, CLINFO
"Connection_Handler::connect_non_local_receptacle - "
"Connection <%C> successfully established.\n",
@@ -597,6 +605,9 @@ namespace CIAO
}
Components::Cookie_var cookie = publisher->subscribe (endpoint.portName.in (),
event.in ());
+#if defined (CIAO_PRE_ESTABLISH_CONNECTIONS)
+ this->validate_connection(conn.name.in (), publisher.in());
+#endif
CIAO_DEBUG (5, (LM_INFO, CLINFO
"Connection_Handler::connect_publisher - "
@@ -704,6 +715,10 @@ namespace CIAO
conn.externalReference[0].portName.in ()));
}
+#if defined (CIAO_PRE_ESTABLISH_CONNECTIONS)
+ this->validate_connection(conn.name.in (), event.in());
+#endif
+
CIAO_DEBUG (5, (LM_INFO, CLINFO
"Connection_Handler::connect_consumer - "
"Connection <%C> successfully established.\n",
@@ -775,6 +790,9 @@ namespace CIAO
emitter->connect_consumer (endpoint.portName.in (),
event.in ());
+#if defined (CIAO_PRE_ESTABLISH_CONNECTIONS)
+ this->validate_connection(conn.name.in (), emitter.in());
+#endif
CIAO_DEBUG (5, (LM_INFO, CLINFO
"Connection_Handler::connect_emitter - "
@@ -796,9 +814,14 @@ namespace CIAO
CIAO_TRACE ("Connection_Handler::disconnect_non_local");
::Components::CCMObject_var obj = this->get_ccm_object (conn.name.in ());
+ CIAO_DEBUG (6, (LM_DEBUG, CLINFO
+ "Connection_Handler::disconnect_non_local - "
+ "About to disconnect <%C>\n",
+ conn.name.in()));
::CORBA::Object_var safe_tmp =
obj->disconnect (port_name,
this->get_cookie (conn.name.in ()));
+
this->remove_cookie (conn.name.in ());
}
@@ -972,6 +995,9 @@ namespace CIAO
facet_endpoint.portName.in (),
receptacle,
receptacle_endpoint.portName.in ());
+#if defined (CIAO_PRE_ESTABLISH_CONNECTIONS)
+ this->validate_connection(conn.name.in (), facet);
+#endif
CIAO_DEBUG (5, (LM_INFO, CLINFO
"Connection_Handler::connect_local_port - "
"Connected local port <%C>:<%C> to <%C>:<%C>\n",
@@ -1062,6 +1088,36 @@ namespace CIAO
receptacle_endpoint.portName.in ()));
}
+ void
+ Connection_Handler::validate_connection (const char * conn,
+ ::CORBA::Object_ptr obj)
+ {
+ CIAO_TRACE ("Connection_Handler::validate_connection");
+ try
+ {
+ if (!::CORBA::is_nil (obj))
+ {
+ ::CORBA::PolicyList_var pl;
+ if (obj->_validate_connection (pl.out ()))
+ {
+ CIAO_DEBUG (6, (LM_DEBUG, CLINFO "Connection_Handler::validate_connection - "
+ "Succesfully validated connection <%C>. Connection has been pre-established.\n",
+ conn));
+ }
+ else
+ {
+ CIAO_ERROR (1, (LM_ERROR, CLINFO "Connection_Handler::validate_connection - "
+ "Failed to pre-establish a connection <%C>.\n",
+ conn));
+ }
+ }
+ }
+ catch (const ::CORBA::Exception &ex)
+ {
+ ex._tao_print_exception("Connection_Handler::validate_connection");
+ }
+ }
+
bool
Connection_Handler::is_local_connection (const ::Deployment::PlanConnectionDescription &conn)
{
@@ -1085,6 +1141,11 @@ namespace CIAO
{
CIAO_TRACE ("Connection_Handler::insert_cookie");
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->cookies_mutex_,
+ CORBA::NO_RESOURCES ());
+
std::pair <std::string, CONNECTION_INFO> value_to_insert (connection_name,
conn_info);
std::pair<COOKIES::iterator, bool> ret = this->cookies_.insert (value_to_insert);
@@ -1112,6 +1173,11 @@ namespace CIAO
{
CIAO_TRACE ("Connection_Handler::remove_cookie");
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->cookies_mutex_,
+ CORBA::NO_RESOURCES ());
+
COOKIES::iterator it = this->cookies_.find (connection_name);
if (it == this->cookies_.end ())
{
@@ -1134,6 +1200,11 @@ namespace CIAO
{
CIAO_TRACE ("Connection_Handler::get_cookie");
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ guard,
+ this->cookies_mutex_,
+ CORBA::NO_RESOURCES ());
+
COOKIES::iterator it = this->cookies_.find (connection_name);
if (it == this->cookies_.end ())
{
@@ -1157,6 +1228,8 @@ namespace CIAO
::Components::CCMObject_ptr
Connection_Handler::get_ccm_object (const char * connection_name)
{
+ CIAO_TRACE ("Connection_Handler::get_ccm_object");
+
COOKIES::iterator it = this->cookies_.find (connection_name);
if (it == this->cookies_.end ())
{
@@ -1167,6 +1240,7 @@ namespace CIAO
throw ::Deployment::InvalidConnection (connection_name,
"Unable to find correct cookie");
}
+
::Components::CCMObject_var ret = it->second.second;
if (::CORBA::is_nil (ret.in ()))
{
@@ -1183,6 +1257,7 @@ namespace CIAO
::CORBA::ULong
Connection_Handler::retrieve_endpoint (const ::Deployment::PlanConnectionDescription &conn)
{
+ CIAO_TRACE ("Connection_Handler::retrieve_endpoint");
if (conn.internalEndpoint.length () == 0)
{
CIAO_ERROR (1, (LM_ERROR, CLINFO
diff --git a/CIAO/ciao/Deployment/Handlers/Connection_Handler.h b/CIAO/ciao/Deployment/Handlers/Connection_Handler.h
index 8238f2fe9a6..de4d22a7436 100644
--- a/CIAO/ciao/Deployment/Handlers/Connection_Handler.h
+++ b/CIAO/ciao/Deployment/Handlers/Connection_Handler.h
@@ -96,6 +96,9 @@ namespace CIAO
bool is_local_connection (const ::Deployment::PlanConnectionDescription &conn);
+ void validate_connection (const char * conn,
+ ::CORBA::Object_ptr obj);
+
::CORBA::ULong retrieve_endpoint (const ::Deployment::PlanConnectionDescription &conn);
typedef std::pair < ::Components::Cookie_var,
@@ -113,6 +116,8 @@ namespace CIAO
::Components::CCMObject_ptr get_ccm_object (const char * connection_name);
COOKIES cookies_;
+
+ TAO_SYNCH_MUTEX cookies_mutex_;
};
}
#endif
diff --git a/CIAO/ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors.mpc b/CIAO/ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors.mpc
index ff817cc208c..6e1dd990a85 100644
--- a/CIAO/ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors.mpc
+++ b/CIAO/ciao/Deployment/Interceptors/CIAO_Deployment_Interceptors.mpc
@@ -1,5 +1,5 @@
// $Id$
-project (CIAO_Deployment_Interceptors) : ciao_base, ciao_lib, ciao_output, \
+project (CIAO_Deployment_Interceptors) : install, ciao_base, ciao_lib, ciao_output, \
naming, ciao_logger, dance_stub, dance_deployment_scheduler {
dynamicflags += CIAO_DEPLOYMENT_INTERCEPTORS_BUILD_DLL
@@ -12,4 +12,8 @@ project (CIAO_Deployment_Interceptors) : ciao_base, ciao_lib, ciao_output, \
Deployment_Interceptors.h
Name_Utilities.h
}
+
+ specific {
+ install_dir = ciao/Deployment/Interceptors
+ }
}
diff --git a/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.cpp b/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.cpp
index 08ffebefa2f..a548c5fa45a 100644
--- a/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.cpp
+++ b/CIAO/ciao/Deployment/Interceptors/Deployment_Interceptors.cpp
@@ -116,7 +116,7 @@ namespace CIAO
CORBA::Object_var obj;
props[i].value >>= CORBA::Any::to_object (obj);
- ctx_ = CosNaming::NamingContext::_narrow (obj.in ());
+ this->ctx_ = CosNaming::NamingContext::_narrow (obj.in ());
}
}
}
diff --git a/CIAO/ciao/Servants/Connector_Servant_Impl_Base.cpp b/CIAO/ciao/Servants/Connector_Servant_Impl_Base.cpp
index d9155d9a286..aa2b5772680 100644
--- a/CIAO/ciao/Servants/Connector_Servant_Impl_Base.cpp
+++ b/CIAO/ciao/Servants/Connector_Servant_Impl_Base.cpp
@@ -33,28 +33,34 @@ namespace CIAO
try
{
- PortableServer::POA_var port_poa =
- this->container_->the_port_POA ();
+ Container_var cnt_safe = Container::_duplicate(this->container_.in ());
+ PortableServer::POA_var port_poa = cnt_safe->the_port_POA ();
- // Removing Facets
- for (FacetTable::const_iterator iter =
- this->facet_table_.begin ();
- iter != this->facet_table_.end ();
- ++iter)
- {
- PortableServer::ObjectId_var facet_id =
- port_poa->reference_to_id (iter->second);
+ {
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ mon,
+ this->lock_,
+ CORBA::NO_RESOURCES ());
+ // Removing Facets
+ for (FacetTable::const_iterator iter =
+ this->facet_table_.begin ();
+ iter != this->facet_table_.end ();
+ ++iter)
+ {
+ PortableServer::ObjectId_var facet_id =
+ port_poa->reference_to_id (iter->second);
- port_poa->deactivate_object (facet_id);
+ port_poa->deactivate_object (facet_id);
- CIAO::Servant_Activator_var sa =
- this->container_->ports_servant_activator ();
+ CIAO::Servant_Activator_var sa =
+ cnt_safe->ports_servant_activator ();
- if (!CORBA::is_nil (sa.in ()))
- {
- sa->update_port_activator (facet_id.in ());
- }
- }
+ if (!CORBA::is_nil (sa.in ()))
+ {
+ sa->update_port_activator (facet_id.in ());
+ }
+ }
+ }
this->ccm_remove ();
@@ -189,19 +195,25 @@ namespace CIAO
retval->length (this->facet_table_.size ());
CORBA::ULong i = 0UL;
- for (FacetTable::const_iterator iter =
- this->facet_table_.begin ();
- iter != this->facet_table_.end ();
- ++iter, ++i)
- {
- ::Components::FacetDescription *fd = 0;
- ACE_NEW_THROW_EX (fd,
- ::OBV_Components::FacetDescription (iter->first.c_str (),
- iter->second->_interface_repository_id (),
- iter->second),
- CORBA::NO_MEMORY ());
- retval[i] = fd;
- }
+ {
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ mon,
+ this->lock_,
+ CORBA::NO_RESOURCES ());
+ for (FacetTable::const_iterator iter =
+ this->facet_table_.begin ();
+ iter != this->facet_table_.end ();
+ ++iter, ++i)
+ {
+ ::Components::FacetDescription *fd = 0;
+ ACE_NEW_THROW_EX (fd,
+ ::OBV_Components::FacetDescription (iter->first.c_str (),
+ iter->second->_interface_repository_id (),
+ iter->second),
+ CORBA::NO_MEMORY ());
+ retval[i] = fd;
+ }
+ }
return retval._retn ();
}
@@ -502,7 +514,9 @@ namespace CIAO
}
{
- ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, mon, this->lock_,
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ mon,
+ this->lock_,
CORBA::NO_RESOURCES ());
this->facet_table_[port_name] = ::CORBA::Object::_duplicate (port_ref);
diff --git a/CIAO/ciao/Servants/Extension/Servant_Impl_T.cpp b/CIAO/ciao/Servants/Extension/Servant_Impl_T.cpp
index 72a7166d719..263a27417b1 100644
--- a/CIAO/ciao/Servants/Extension/Servant_Impl_T.cpp
+++ b/CIAO/ciao/Servants/Extension/Servant_Impl_T.cpp
@@ -24,12 +24,12 @@ namespace CIAO
ACE_NEW (this->context_,
CONTEXT (home, c, this, ins_name));
- ::Components::ExtensionComponent_var scom =
+ ::Components::ExtensionComponent_var ecom =
::Components::ExtensionComponent::_narrow (exe);
- if (! ::CORBA::is_nil (scom.in ()))
+ if (! ::CORBA::is_nil (ecom.in ()))
{
- scom->set_extension_context (this->context_);
+ ecom->set_extension_context (this->context_);
}
else
{
@@ -108,10 +108,10 @@ namespace CIAO
CORBA::Object_ptr
Extension_Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::_get_component (void)
{
- ::Components::ExtensionContext_var sc =
+ ::Components::ExtensionContext_var ec =
::Components::ExtensionContext::_narrow (this->context_);
- if (! ::CORBA::is_nil (sc.in ()))
+ if (! ::CORBA::is_nil (ec.in ()))
{
// @todo return sc->get_CCM_object ();
}
diff --git a/CIAO/ciao/Servants/Home_Servant_Impl_T.cpp b/CIAO/ciao/Servants/Home_Servant_Impl_T.cpp
index 4d9ee76f6ff..cc334924559 100644
--- a/CIAO/ciao/Servants/Home_Servant_Impl_T.cpp
+++ b/CIAO/ciao/Servants/Home_Servant_Impl_T.cpp
@@ -69,15 +69,17 @@ namespace CIAO
{
CIAO_TRACE ("Home_Servant_Impl<>::remove_component");
- PortableServer::POA_var poa =
- this->container_->the_POA ();
- PortableServer::ObjectId_var oid =
- poa->reference_to_id (comp);
+ typename CONTAINER::_var_type cnt_safe =
+ CONTAINER::_duplicate (this->container_.in());
+ PortableServer::POA_var poa = cnt_safe->the_POA ();
+ PortableServer::ObjectId_var oid = poa->reference_to_id (comp);
- Components::CCMObject_var ccm_obj_var = Components::CCMObject::_nil ();
+ Components::CCMObject_var ccm_obj_var;
if (objref_map_.find (oid.in (), ccm_obj_var) != 0)
{
- CIAO_ERROR (1, (LM_WARNING, CLINFO "Home_Servant_Impl<>::remove_component - Invalid component object reference\n"));
+ CIAO_ERROR (1, (LM_WARNING, CLINFO
+ "Home_Servant_Impl<>::remove_component - "
+ "Invalid component object reference\n"));
throw Components::RemoveFailure ();
}
@@ -94,7 +96,9 @@ namespace CIAO
_ciao_comp->remove ();
}
- CIAO_DEBUG (6, (LM_INFO, CLINFO "Home_Servant_Impl<>::remove_component - Removed the component\n"));
+ CIAO_DEBUG (6, (LM_INFO, CLINFO
+ "Home_Servant_Impl<>::remove_component - "
+ "Removed the component\n"));
}
template <typename BASE_SKEL,
@@ -113,8 +117,9 @@ namespace CIAO
Components::CCMObject_var ccm_obj_ptr;
if (objref_map_.unbind (oid, ccm_obj_ptr) != 0)
{
- CIAO_ERROR (1, (LM_ERROR, CLINFO "Home_Servant_Impl<>::update_component_map - "
- "Invalid component object reference\n"));
+ CIAO_ERROR (1, (LM_ERROR, CLINFO
+ "Home_Servant_Impl<>::update_component_map - "
+ "Invalid component object reference\n"));
}
}
@@ -148,12 +153,16 @@ namespace CIAO
if (::CORBA::is_nil (this->executor_.in ()))
{
- CIAO_ERROR (1, (LM_ERROR, CLINFO "Home_Servant_Impl<>:create - nil executor reference\n"));
+ CIAO_ERROR (1, (LM_ERROR, CLINFO
+ "Home_Servant_Impl<>:create - "
+ "nil executor reference\n"));
throw CORBA::INTERNAL ();
}
- ::Components::EnterpriseComponent_var _ciao_ec =
- this->executor_->create ();
+ typename EXEC::_var_type exec_safe =
+ EXEC::_duplicate (this->executor_.in());
+
+ ::Components::EnterpriseComponent_var _ciao_ec = exec_safe->create ();
typedef typename COMP_SVNT::_exec_type exec_type;
typename COMP_SVNT::_exec_type::_var_type _ciao_comp =
@@ -175,7 +184,10 @@ namespace CIAO
{
CIAO_TRACE ("Home_Servant_Impl<>::_ciao_activate_component");
- CORBA::Object_var hobj = this->container_->get_objref (this);
+ typename CONTAINER::_var_type cnt_safe =
+ CONTAINER::_duplicate (this->container_.in());
+
+ CORBA::Object_var hobj = cnt_safe->get_objref (this);
Components::CCMHome_var home =
Components::CCMHome::_narrow (hobj.in ());
@@ -194,16 +206,16 @@ namespace CIAO
home.in (),
(this->ins_name_ + buffer).c_str (),
this,
- this->container_),
+ cnt_safe),
CORBA::NO_MEMORY ());
PortableServer::ServantBase_var safe (svt);
PortableServer::ObjectId_var oid;
CORBA::Object_var objref =
- this->container_->install_servant (svt,
- Container_Types::COMPONENT_t,
- oid.out ());
+ cnt_safe->install_servant (svt,
+ Container_Types::COMPONENT_t,
+ oid.out ());
typedef typename COMP_SVNT::_stub_type stub_type;
typename COMP_SVNT::_stub_var_type ho = stub_type::_narrow (objref.in ());
@@ -229,7 +241,10 @@ namespace CIAO
{
CIAO_TRACE ("Home_Servant_Impl<>::_ciao_passivate_component");
- this->container_->uninstall_component (comp);
+ typename CONTAINER::_var_type cnt_safe =
+ CONTAINER::_duplicate (this->container_.in());
+
+ cnt_safe->uninstall_component (comp);
}
}
diff --git a/CIAO/ciao/Servants/Servant_Impl_Base.cpp b/CIAO/ciao/Servants/Servant_Impl_Base.cpp
index ad9096a23af..35c45e44fee 100644
--- a/CIAO/ciao/Servants/Servant_Impl_Base.cpp
+++ b/CIAO/ciao/Servants/Servant_Impl_Base.cpp
@@ -25,6 +25,8 @@ namespace CIAO
try
{
+ Container_var cnt_safe =
+ Container::_duplicate(this->container_.in ());
PortableServer::POA_var port_poa =
this->container_->the_port_POA ();
@@ -39,7 +41,7 @@ namespace CIAO
port_poa->deactivate_object (cons_id);
CIAO::Servant_Activator_var sa =
- this->container_->ports_servant_activator ();
+ cnt_safe->ports_servant_activator ();
if (!CORBA::is_nil (sa.in ()))
{
@@ -275,7 +277,9 @@ namespace CIAO
}
{
- ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, mon, this->lock_,
+ ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX,
+ mon,
+ this->lock_,
CORBA::NO_RESOURCES ());
this->consumer_table_[port_name] = ::Components::EventConsumerBase::_duplicate (port_ref);
diff --git a/CIAO/ciao/Servants/Session/Servant_Impl_T.cpp b/CIAO/ciao/Servants/Session/Servant_Impl_T.cpp
index 3b78d1d6680..32066508613 100644
--- a/CIAO/ciao/Servants/Session/Servant_Impl_T.cpp
+++ b/CIAO/ciao/Servants/Session/Servant_Impl_T.cpp
@@ -46,6 +46,7 @@ namespace CIAO
typename CONTEXT>
Session_Servant_Impl<BASE_SKEL, EXEC, CONTEXT>::~Session_Servant_Impl (void)
{
+ //TODO: thread safe? How?
if (this->executor_->_refcount_value () > 1)
{
CIAO_ERROR (1,