]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
CCAR: catch CORBA::Exception in shutdownServers when trying to _narrow the container
authorcaremoli <caremoli>
Fri, 26 Sep 2008 15:03:03 +0000 (15:03 +0000)
committercaremoli <caremoli>
Fri, 26 Sep 2008 15:03:03 +0000 (15:03 +0000)
(_narrow can throw a CORBA::TRANSIENT in some cases)
shutdown did not go to the end when a container was killed before without deregistering
in naming service

src/Container/SALOME_ContainerManager.cxx

index 8d887aed84650f7b280c680bf163590811284e8f..1c3d5704d28f6557031339fd6ad4e9e7cbf9f983 100644 (file)
@@ -124,14 +124,21 @@ void SALOME_ContainerManager::ShutdownContainers()
   if( isOK ){
     vector<string> vec = _NS->list_directory_recurs();
     list<string> lstCont;
-    for(vector<string>::iterator iter = vec.begin();iter!=vec.end();iter++){
-      SCRUTE((*iter));
-      CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
-      Engines::Container_var cont=Engines::Container::_narrow(obj);
-      if(!CORBA::is_nil(cont)){
-       lstCont.push_back((*iter));
+    for(vector<string>::iterator iter = vec.begin();iter!=vec.end();iter++)
+      {
+        SCRUTE((*iter));
+        CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
+        try
+          {
+            Engines::Container_var cont=Engines::Container::_narrow(obj);
+            if(!CORBA::is_nil(cont))
+             lstCont.push_back((*iter));
+          }
+        catch(const CORBA::Exception& e)
+          {
+            // ignore this entry and continue
+          }
       }
-    }
     MESSAGE("Container list: ");
     for(list<string>::iterator iter=lstCont.begin();iter!=lstCont.end();iter++){
       SCRUTE((*iter));
@@ -280,18 +287,16 @@ StartContainer(const Engines::MachineParameters& params,
   CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
   if ( !CORBA::is_nil(obj) )
     {
-      // shutdown the registered container if it exists
-      Engines::Container_var cont=Engines::Container::_narrow(obj);
-      if(!CORBA::is_nil(cont))
+      try
         {
-          try
-            {
-              cont->Shutdown();
-            }
-          catch(CORBA::Exception&)
-            {
-              INFOS("CORBA::Exception ignored.");
-            }
+          // shutdown the registered container if it exists
+          Engines::Container_var cont=Engines::Container::_narrow(obj);
+          if(!CORBA::is_nil(cont))
+            cont->Shutdown();
+        }
+      catch(CORBA::Exception&)
+        {
+          INFOS("CORBA::Exception ignored.");
         }
     }