]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
PR: correction for application shutdown
authorprascle <prascle>
Thu, 8 Apr 2004 06:48:48 +0000 (06:48 +0000)
committerprascle <prascle>
Thu, 8 Apr 2004 06:48:48 +0000 (06:48 +0000)
src/Session/SALOME_Session_Server.cxx
src/Session/Session_ServerLauncher.cxx
src/Session/Session_ServerLauncher.hxx
src/Session/Session_ServerThread.cxx

index 408ed17283da925008e4a1193e6f2073ba42bc1f..26babef31855fc2eef7c5c58c7e74723b03efe7d 100644 (file)
@@ -222,6 +222,8 @@ int main(int argc, char **argv)
          MESSAGE (confMsg );
          QAD_CONFIG->createConfigFile(true);
        }
+      orb->shutdown(0);
+      myServerLauncher->KillAll();
       aCatch.Deactivate();
     }
   catch (SALOME_Exception& e)
@@ -249,5 +251,6 @@ int main(int argc, char **argv)
     {
       INFOS("Caught unknown exception.");
     }
+  MESSAGE("End of SALOME_Session_Server");
   return 0 ;
 }
index 54cf11cba2f76ec5f17ba2b140c9cc71a8a67096..e9def60fba7fbb3c37541c30efab99c6f7b5b562 100644 (file)
@@ -197,7 +197,7 @@ void Session_ServerLauncher::ActivateAll()
        }
       Session_ServerThread* aServerThread
        = new Session_ServerThread(argc, argv, _orb,_root_poa,_GUIMutex);
-      _serverThreads.push_back(aServerThread);
+      _serverThreads.push_front(aServerThread);
 
       aServerThread->Init();
     }
@@ -209,8 +209,23 @@ void Session_ServerLauncher::ActivateAll()
   argv[0] = "Session";
   Session_ServerThread* aServerThread
     = new Session_ServerThread(argc, argv, _orb,_root_poa,_GUIMutex);
-  _serverThreads.push_back(aServerThread);
+  _serverThreads.push_front(aServerThread);
 
   aServerThread->Init();
 }
 
+//=============================================================================
+/*! 
+ *  Destruction des classes serveur dans l'ordre inverse de creation
+ */
+//=============================================================================
+
+void Session_ServerLauncher::KillAll()
+{
+  MESSAGE("Session_ServerLauncher::KillAll()");
+  list<Session_ServerThread*>::iterator itServ;
+  for (itServ = _serverThreads.begin(); itServ !=_serverThreads.end(); itServ++)
+    {
+      delete (*itServ);
+    }
+}
index 893754ac06142604c0d9407eb6d698b2f8fa6723..45804e17d20eead3446e771fcd13e7f105fcf6cb 100644 (file)
@@ -65,14 +65,13 @@ public:
                         QWaitCondition *ServerLaunch);
   virtual ~Session_ServerLauncher();
   void run();
-protected:
+  void KillAll();
 
+protected:
   void CheckArgs();
-
   void ActivateAll();
 
 private:
-
   int _argc;
   char ** _argv;
   CORBA::ORB_var _orb;
index 3e61eea0a05c628f8bd6241955eb484b34382471..e5e4f055c69054b9102a72a5f18c574120813958 100644 (file)
@@ -237,16 +237,13 @@ void Session_ServerThread::ActivateModuleCatalog(int argc,
 
       SALOME_ModuleCatalogImpl* Catalogue_i
        = new SALOME_ModuleCatalogImpl(argc, argv);
-      MESSAGE("---");
+
       // Tell the POA that the objects are ready to accept requests.
 
       _root_poa->activate_object (Catalogue_i);
-      MESSAGE("---");
 
       CORBA::Object_ptr myCata = Catalogue_i->_this();
-      MESSAGE("---");
       _NS->Register(myCata ,"/Kernel/ModulCatalog");
-      MESSAGE("---");
     }
   catch(CORBA::SystemException&)
     {
@@ -293,7 +290,6 @@ void Session_ServerThread::ActivateSALOMEDS(int argc,
 
       PortableServer::ObjectId_var myStudyManager_iid
        = _root_poa->activate_object(myStudyManager_i);
-
       myStudyManager_i->register_name("/myStudyManager");
     }
   catch(CORBA::SystemException&)
@@ -350,8 +346,7 @@ void Session_ServerThread::ActivateRegistry(int argc,
   Registry::Components_var varComponents;
   try
     {
-      //RegistryService *ptrRegistry = SINGLETON_<RegistryService>::Instance();
-      RegistryService *ptrRegistry = new RegistryService();
+      RegistryService *ptrRegistry = SINGLETON_<RegistryService>::Instance();
       ptrRegistry->SessionName( ptrSessionName );
       varComponents = ptrRegistry->_this();
       // The RegistryService must not already exist.
@@ -408,12 +403,10 @@ void Session_ServerThread::ActivateContainer(int argc,
          PortableServer::ImplicitActivationPolicy_var implicitActivation =
            _root_poa->create_implicit_activation_policy(
                                PortableServer::NO_IMPLICIT_ACTIVATION);
-         MESSAGE("---");
          // default = NO_IMPLICIT_ACTIVATION
          PortableServer::ThreadPolicy_var threadPolicy =
            _root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL);
          // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL
-         MESSAGE("---");
       
          // create policy list
          CORBA::PolicyList policyList;
@@ -422,7 +415,6 @@ void Session_ServerThread::ActivateContainer(int argc,
            _duplicate(implicitActivation);
          policyList[1] = PortableServer::ThreadPolicy::
            _duplicate(threadPolicy);
-         MESSAGE("---");
       
          PortableServer::POAManager_var nil_mgr
            = PortableServer::POAManager::_nil();
@@ -431,12 +423,10 @@ void Session_ServerThread::ActivateContainer(int argc,
                                              policyList);
          //with nil_mgr instead of pman,
          //a new POA manager is created with the new POA
-         MESSAGE("---");
       
          // destroy policy objects
          implicitActivation->destroy();
          threadPolicy->destroy();
-         MESSAGE("---");
 
          // obtain the factory poa manager
          PortableServer::POAManager_var pmanfac = factory_poa->the_POAManager();
@@ -444,7 +434,6 @@ void Session_ServerThread::ActivateContainer(int argc,
          MESSAGE("pmanfac->activate()");
        }
       
-      MESSAGE("---");
       char *containerName = "";
       if (argc >1) 
        {