From: caremoli Date: Fri, 26 Sep 2008 15:03:03 +0000 (+0000) Subject: CCAR: catch CORBA::Exception in shutdownServers when trying to _narrow the container X-Git-Tag: RELIQUAT_4x_25102008~28 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f6823e7b3449e5b7b5718752c92533e0e79f86b3;p=modules%2Fkernel.git CCAR: catch CORBA::Exception in shutdownServers when trying to _narrow the container (_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 --- diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 8d887aed8..1c3d5704d 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -124,14 +124,21 @@ void SALOME_ContainerManager::ShutdownContainers() if( isOK ){ vector vec = _NS->list_directory_recurs(); list lstCont; - for(vector::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::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::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."); } }