diff options
Diffstat (limited to 'CIAO/ciao/Deployment/Handlers/CIAO_State.cpp')
-rw-r--r-- | CIAO/ciao/Deployment/Handlers/CIAO_State.cpp | 183 |
1 files changed, 139 insertions, 44 deletions
diff --git a/CIAO/ciao/Deployment/Handlers/CIAO_State.cpp b/CIAO/ciao/Deployment/Handlers/CIAO_State.cpp index 97c58878251..63661bd3285 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,10 +40,18 @@ 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 ()) - this->containers_.erase (pos); + { + this->containers_.erase (pos); + } } CIAO::Container_ptr @@ -46,6 +59,11 @@ 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 ()) @@ -63,33 +81,62 @@ 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 +144,18 @@ 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 +166,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 +195,32 @@ 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,6 +228,11 @@ 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 ()) @@ -159,11 +248,17 @@ 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); if (cont != this->instance_container_.end ()) - return cont->second.c_str (); + { + return cont->second.c_str (); + } CIAO_ERROR (1, (LM_ERROR, CLINFO "Deployment_State::instance_to_container - " |