summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-01-20 02:49:58 +0000
committerdengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-01-20 02:49:58 +0000
commita9f6172a5433153779a9c87fd7a797b963fcc294 (patch)
tree9c05594a9884f41262b8b2f27f1ef4b4895654a6
parent692f1cadd0e96dc23f02266b8ff3c427ca177c4c (diff)
downloadATCD-a9f6172a5433153779a9c87fd7a797b963fcc294.tar.gz
*** empty log message ***
-rw-r--r--TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp10
-rw-r--r--TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp76
-rw-r--r--TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.h10
-rw-r--r--TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp8
4 files changed, 83 insertions, 21 deletions
diff --git a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp
index 36966457426..9e9b35a5c49 100644
--- a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp
+++ b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp
@@ -575,8 +575,8 @@ CIAO::NodeApplication_Impl::create_container (
::Components::CreateFailure,
::Components::InvalidConfiguration))
{
- if (CIAO::debug_level () > 1)
- ACE_DEBUG ((LM_DEBUG, "ENTERING: NodeApplication_Impl::create_container()\n"));
+ //if (CIAO::debug_level () > 1)
+ // ACE_DEBUG ((LM_DEBUG, "ENTERING: NodeApplication_Impl::create_container()\n"));
CORBA::PolicyList_var policies
= this->configurator_.find_container_policies (properties);
@@ -627,9 +627,9 @@ CIAO::NodeApplication_Impl::create_container (
this->container_set_.add (ci.in ());
}
- if (CIAO::debug_level () > 1)
- ACE_DEBUG ((LM_DEBUG,
- "LEAVING: NodeApplication_Impl::create_container()\n"));
+ //if (CIAO::debug_level () > 1)
+ // ACE_DEBUG ((LM_DEBUG,
+ // "LEAVING: NodeApplication_Impl::create_container()\n"));
return ci._retn ();
}
diff --git a/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp b/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp
index 6803f142b25..5e99d7e7896 100644
--- a/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp
+++ b/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp
@@ -118,7 +118,7 @@ CIAO::NodeManager_Impl_Base::
set_all_facets (ACE_CString &name,
const ::Components::FacetDescriptions_var & facets)
{
- this->comp_facets_map_.bind (name, facets);
+ this->comp_facets_map_.rebind (name, facets);
}
void
@@ -126,7 +126,28 @@ CIAO::NodeManager_Impl_Base::
set_all_consumers (ACE_CString &name,
const ::Components::ConsumerDescriptions_var & consumers)
{
- this->comp_consumers_map_.bind (name, consumers);
+ this->comp_consumers_map_.rebind (name, consumers);
+}
+
+CORBA::StringSeq *
+CIAO::NodeManager_Impl_Base::shared_components_seq (void)
+{
+ CORBA::StringSeq * retv;
+ ACE_NEW_RETURN (retv, CORBA::StringSeq, 0);
+ retv->length (0);
+
+ ACE_Unbounded_Set<ACE_CString>::iterator end = this->shared_components_.end ();
+ for (ACE_Unbounded_Set<ACE_CString>::iterator
+ iter = this->shared_components_.begin ();
+ iter != end;
+ ++iter)
+ {
+ CORBA::ULong curr_len = retv->length ();
+ retv->length (curr_len + 1);
+ (*retv)[curr_len] = (*iter).c_str ();
+ }
+
+ return retv;
}
Deployment::NodeApplicationManager_ptr
@@ -161,9 +182,7 @@ CIAO::NodeManager_Impl_Base::preparePlan (const Deployment::DeploymentPlan &plan
}
else
{
- CORBA::ULong len = this->shared_components_.length ();
- shared_components_.length (len + 1);
- this->shared_components_[len] = plan.instance[i].name.in ();
+ this->shared_components_.insert (plan.instance[i].name.in ());
++entry->int_id_; // increase ref count by 1
}
}
@@ -212,11 +231,11 @@ CIAO::NodeManager_Impl_Base::preparePlan (const Deployment::DeploymentPlan &plan
// won't be instantiated again
Deployment::NodeApplicationManager_var nam =
Deployment::NodeApplicationManager::_narrow (obj.in ());
- ACE_TRY_CHECK;
-
- nam->set_shared_components (this->shared_components_);
- ACE_TRY_CHECK;
+ // Convert the ACE Set into CORBA sequence, and make the remote invocation
+ CORBA::StringSeq_var shared = this->shared_components_seq ();
+ nam->set_shared_components (shared.in ());
+
// narrow should return a nil reference if it fails.
return Deployment::NodeApplicationManager::_narrow (nam.in ());
}
@@ -242,8 +261,8 @@ CIAO::NodeManager_Impl_Base::preparePlan (const Deployment::DeploymentPlan &plan
// Similarly, we should inform NAM about "shared" components, so
// they won't be instantiated again
- nam->set_shared_components (this->shared_components_);
- ACE_TRY_CHECK;
+ CORBA::StringSeq_var shared;
+ nam->set_shared_components (shared.in ());
// Potentially we could reset many other configuration settings
// such as command line options, service configuration file, etc.
@@ -331,6 +350,35 @@ destroyPlan (const Deployment::DeploymentPlan & plan
// we should remove the necesary bindings on this component specified
// in the deployment plan.
+ // Clean up the cached "Facets" and "Consumers" map of the components
+ // whose ref count is 0
+ CORBA::ULong const length = plan.instance.length ();
+ for (CORBA::ULong i = 0; i < length; ++i)
+ {
+ Reference_Count_Map::ENTRY *entry = 0;
+ if (this->ref_count_map_.find (plan.instance[i].name.in (), entry) == 0)
+ {
+ --entry->int_id_; // decrease ref count by 1
+
+ if (entry->int_id_ == 0)
+ {
+ // Remove this component from the shared set
+ this->shared_components_.remove (plan.instance[i].name.in ());
+
+ // Unbind this component from the ref_count_map_
+ this->ref_count_map_.unbind (plan.instance[i].name.in ());
+ }
+ }
+
+ if (this->comp_facets_map_.unbind (plan.instance[i].name.in ()) != 0 ||
+ this->comp_consumers_map_.unbind (plan.instance[i].name.in ()) != 0)
+ {
+ ACE_TRY_THROW
+ (Deployment::StopError ("NodeManager_Impl_Base::destroyPlan ",
+ "Unable to find component instance"));
+ }
+ }
+
// Create a list of components that are not to be removed, and send
// this list to the NAM, who will delegate to appropriate NAs to
// remove bindings from these components.
@@ -344,11 +392,13 @@ destroyPlan (const Deployment::DeploymentPlan & plan
// If
CORBA::Object_var obj =
this->poa_->id_to_reference (this->map_.get_nam (plan.UUID.in ()));
- ACE_TRY_CHECK;
Deployment::NodeApplicationManager_var nam =
Deployment::NodeApplicationManager::_narrow (obj.in ());
- ACE_TRY_CHECK;
+
+ // Convert the ACE Set into CORBA sequence, and reset it.
+ CORBA::StringSeq_var shared = this->shared_components_seq ();
+ nam->set_shared_components (shared.in ());
nam->destroyApplication (0);
diff --git a/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.h b/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.h
index 6eb12a49433..70efed019dc 100644
--- a/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.h
+++ b/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.h
@@ -175,12 +175,16 @@ namespace CIAO
Reference_Count_Map ref_count_map_;
- /// A list to track the names of shared component instances
- CORBA::StringSeq shared_components_;
+ /// A set to track the names of shared component instances
+ //CORBA::StringSeq shared_components_;
+ ACE_Unbounded_Set<ACE_CString> shared_components_;
+
+ CORBA::StringSeq * shared_components_seq (void);
/// Cached object references of ports (facets/consumers) of
/// all components. This is useful for getting the port object
- /// references of "shared components".
+ /// references of "shared components". The key in the map
+ /// is the component instance name.
typedef
ACE_Hash_Map_Manager_Ex <ACE_CString,
Components::FacetDescriptions_var,
diff --git a/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp b/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp
index e0f63e25116..230ac14beb3 100644
--- a/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp
+++ b/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp
@@ -188,6 +188,14 @@ namespace CIAO
"Press <Enter> to tear down application\n"));
char dummy [256];
std::cin.getline (dummy, 256);
+
+ // Tear down the assembly
+ ACE_DEBUG ((LM_DEBUG,
+ "Plan_Launcher: destroy the application....."));
+ if (! launcher.teardown_plan (uuid))
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) CIAO_PlanLauncher:tear down assembly failed: "
+ "unkonw plan uuid.\n"));
}
}
else if (mode == pl_mode_redeployment && new_package_url != 0) // do redeployment