From dc857c12966b4aff9d82b1213db98b1f39462570 Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 13 Nov 2012 08:47:17 +0000 Subject: [PATCH] 0021688: [CEA 572] Issue when using runSalome -k -t --- src/Session/SALOME_Session_Server.cxx | 7 +++++-- src/Session/Session_ServerLauncher.cxx | 10 ++++++++++ src/Session/Session_ServerLauncher.hxx | 1 + src/Session/Session_ServerThread.cxx | 8 +++++++- src/Session/Session_ServerThread.hxx | 3 +++ 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index f94e9a639..a0c6f8833 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -659,11 +659,14 @@ int main( int argc, char **argv ) // unlock Session mutex _SessionMutex.unlock(); - if ( shutdownAll ) + if ( myServerLauncher ) + myServerLauncher->ShutdownAll(); // shutdown embedded servers + + if ( shutdownAll ) // shutdown standalone servers shutdownServers( _NS ); if ( myServerLauncher ) - myServerLauncher->KillAll(); // kill embedded servers + myServerLauncher->KillAll(); // kill embedded servers // Unregister session server SALOME_Session_i* sessionServant = dynamic_cast( poa->reference_to_servant( session.in() ) ); diff --git a/src/Session/Session_ServerLauncher.cxx b/src/Session/Session_ServerLauncher.cxx index 39c9c5ef6..9a442e9f7 100755 --- a/src/Session/Session_ServerLauncher.cxx +++ b/src/Session/Session_ServerLauncher.cxx @@ -230,6 +230,16 @@ void Session_ServerLauncher::ActivateAll() delete[] argv; } +void Session_ServerLauncher::ShutdownAll() +{ + MESSAGE("Session_ServerLauncher::ShutdownAll()"); + std::list::reverse_iterator itServ; + for (itServ = _serverThreads.rbegin(); itServ !=_serverThreads.rend(); itServ++) + { + (*itServ)->Shutdown(); + } +} + /*! Destruction des classes serveur dans l'ordre inverse de creation */ diff --git a/src/Session/Session_ServerLauncher.hxx b/src/Session/Session_ServerLauncher.hxx index 39b9eaa83..c2cd32176 100755 --- a/src/Session/Session_ServerLauncher.hxx +++ b/src/Session/Session_ServerLauncher.hxx @@ -67,6 +67,7 @@ public: QWaitCondition *SessionStarted); virtual ~Session_ServerLauncher(); void run(); + void ShutdownAll(); void KillAll(); protected: diff --git a/src/Session/Session_ServerThread.cxx b/src/Session/Session_ServerThread.cxx index 07e1e6726..341231c87 100755 --- a/src/Session/Session_ServerThread.cxx +++ b/src/Session/Session_ServerThread.cxx @@ -84,6 +84,7 @@ Session_ServerThread::Session_ServerThread(int argc, _servType =-1; _NS = new SALOME_NamingService(_orb); // one instance per server to limit // multi thread coherence problems + _container = 0; // embedded container } /*! @@ -165,6 +166,11 @@ void Session_ServerThread::Init() } } +void Session_ServerThread::Shutdown() +{ + if ( _container ) _container->Shutdown(); +} + void Session_ServerThread::ActivateModuleCatalog(int argc, char ** argv) { @@ -356,7 +362,7 @@ void Session_ServerThread::ActivateContainer(int argc, containerName = argv[1]; } - new Engines_Container_i(_orb, _root_poa, containerName , argc , argv , true , false); + _container = new Engines_Container_i(_orb, _root_poa, containerName , argc , argv , true , false); } catch(CORBA::SystemException&) { INFOS("Caught CORBA::SystemException."); diff --git a/src/Session/Session_ServerThread.hxx b/src/Session/Session_ServerThread.hxx index e6a970008..46bd6d3cd 100755 --- a/src/Session/Session_ServerThread.hxx +++ b/src/Session/Session_ServerThread.hxx @@ -35,6 +35,7 @@ void WaitForServerReadiness(std::string serverName); class SALOME_NamingService; +class Engines_Container_i; class SESSION_EXPORT Session_ServerThread { @@ -49,6 +50,7 @@ public: PortableServer::POA_ptr poa); virtual ~Session_ServerThread(); void Init(); + void Shutdown(); protected: void ActivateModuleCatalog ( int argc, char ** argv ); void ActivateSALOMEDS ( int argc, char ** argv ); @@ -64,6 +66,7 @@ protected: CORBA::ORB_var _orb; PortableServer::POA_var _root_poa; SALOME_NamingService * _NS; + Engines_Container_i* _container; }; class QMutex; -- 2.39.2