Salome HOME
IMP NPAL13547: Checkbox to kill SALOME completely.
authormkr <mkr@opencascade.com>
Thu, 8 Nov 2007 11:20:28 +0000 (11:20 +0000)
committermkr <mkr@opencascade.com>
Thu, 8 Nov 2007 11:20:28 +0000 (11:20 +0000)
17 files changed:
idl/DSC_Engines.idl
idl/SALOMEDS.idl
idl/SALOME_ContainerManager.idl
idl/SALOME_ModuleCatalog.idl
idl/SALOME_Registry.idl
idl/SALOME_Session.idl
src/Container/SALOME_ContainerManager.cxx
src/Container/SALOME_ContainerManager.hxx
src/DSC/DSC_Basic/ConnectionManager_i.cxx
src/DSC/DSC_Basic/ConnectionManager_i.hxx
src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx
src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx
src/Registry/RegistryService.cxx
src/Registry/RegistryService.hxx
src/SALOMEDS/SALOMEDS_StudyManager_i.cxx
src/SALOMEDS/SALOMEDS_StudyManager_i.hxx
src/Utils/Utils_ORB_INIT.cxx

index 83b558a59c9aec691377e4f3347bcce8eb18a29d..0085608aa188d51545a9933d59c900eb19339210 100644 (file)
@@ -342,6 +342,15 @@ module Engines {
     void disconnect(in connectionId id,
                    in Engines::DSC::Message message) raises(Engines::ConnectionManager::BadId);
 
+    /*!
+      Shutdown the ConnectionManager process.
+    */
+    oneway void ShutdownWithExit();
+
+    /*!
+      Returns the PID of the connection manager
+    */
+    long getPID();
   };
 
 /*--------------------------------------------------------------------------------------------*/
index f4aea4bab6b862f79d05fee98510229514a72c86..885da2c560ce94e8d03f743c9b7e4affb867890d 100644 (file)
@@ -716,6 +716,16 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin
 
     void Shutdown();
 
+/*!
+    Returns the PID of the server
+*/
+    long getPID();
+
+/*!
+    Shutdown the StudyManager process.
+*/    
+    oneway void ShutdownWithExit();
+
 /*! \brief Creation of a new study
 
      Creates a new study with a definite name.
index fe770071256a821440ba9b32ee75bb7b84395200..5013b402d94beb73f5f03b535342dc5684a78b5b 100644 (file)
@@ -115,7 +115,12 @@ struct MachineParameters
                             in ResPolicy policy,
                             in CompoList componentList );
 
+    oneway void ShutdownWithExit();
+
     void ShutdownContainers();
+
+    long getPID();
+
   } ;
   
 /*! \brief Interface of the %resourcesManager
index 27f81b0f6c81c2956894b2b3d8ac057454bdf62e..667bef10bb75e56598b8315b493b10366d99bcb3 100644 (file)
@@ -303,6 +303,16 @@ This interface is used for creation of the module catalog in %SALOME application
   {
     void ping();
 
+/*!
+    Returns the PID of the server
+*/
+    long getPID();
+
+/*!
+    Shutdown the ModuleCatalog process.
+*/    
+    oneway void ShutdownWithExit();
+
 /*! 
  Gets a list of names of computers of the catalog 
 */   
index 8e44332155fb38b77937c111677e1076811ec763..5f27977f64d7a47268dab66363f62ed346a87938 100644 (file)
@@ -48,6 +48,7 @@ module Registry
        interface Components
        {
                void ping();
+               long getPID();
                unsigned long add ( in Infos lesInfos ) ;
                void remove ( in unsigned long id ) ;
                unsigned long size() ;
index f067b753ab40e07388d6d860868de7d13f26552c..041df52a78a07d4e2ed0902ddfa506376fb2b307 100644 (file)
@@ -101,6 +101,10 @@ module SALOME
     Determines whether the server has already been loaded or not.
 */ 
     void ping();
+/*!
+    Returns the PID of the server
+*/
+    long getPID();
 /*!
     Get Active study ID
 */
index 0fc39bd912008bbc000ac732b94cb1abce3bd93a..1b3fd4bdefd3dd2d30db25d89c266dcbdde4b0ef 100644 (file)
@@ -105,6 +105,21 @@ void SALOME_ContainerManager::Shutdown()
   _remove_ref();
 }
 
+//=============================================================================
+/*! CORBA method:
+ *  shutdown the ContainerManager servant and kill the ContainerManager process
+ */
+//=============================================================================
+void SALOME_ContainerManager::ShutdownWithExit()
+{
+  MESSAGE("ShutdownWithExit");
+  PortableServer::ObjectId_var oid = _default_POA()->servant_to_id(this);
+  _default_POA()->deactivate_object(oid);
+  _remove_ref();
+  
+  exit( EXIT_SUCCESS );
+}
+
 //=============================================================================
 /*! CORBA Method:
  *  Loop on all the containers listed in naming service, ask shutdown on each
@@ -144,6 +159,16 @@ void SALOME_ContainerManager::ShutdownContainers()
   }
 }
 
+//=============================================================================
+/*! CORBA Method:
+ *  Returns the PID of the container manager
+ */
+//=============================================================================
+CORBA::Long SALOME_ContainerManager::getPID()
+{
+  return (CORBA::Long)getpid();
+}
+
 //=============================================================================
 /*! CORBA Method:
  *  Find a suitable Container in a list of machines, or start one
index 34888f98c7216ec9dc44cde6acf2684f796c5f3a..b3485ab63bb1814a42bc88d0de8b354795a6816a 100644 (file)
@@ -60,8 +60,11 @@ public:
                const Engines::CompoList& componentList);
 
   void Shutdown();
+  void ShutdownWithExit();
   void ShutdownContainers();
 
+  CORBA::Long getPID();
+
   static const char *_ContainerManagerNameInNS;
 
   // Parallel extension
index 59f3b262408963334a2fbbaa08e133dabe894598..6b1e376a6cdfce40ee541602682f70288af8fd00 100644 (file)
@@ -93,3 +93,15 @@ throw (Engines::ConnectionManager::BadId)
   delete infos;
   ids.erase(id);
 }
+
+void
+ConnectionManager_i::ShutdownWithExit()
+{
+  exit( EXIT_SUCCESS );
+}
+
+CORBA::Long
+ConnectionManager_i::getPID()
+{
+  return (CORBA::Long)getpid();
+}
index c0459f482cdaf9565b744b7d29d01c714b131ed5..ebdfebf358ad79f755edc8a5a869aae3b81e2542 100644 (file)
@@ -67,6 +67,16 @@ class DSC_BASIC_EXPORT ConnectionManager_i :
                    Engines::DSC::Message message)
       throw (Engines::ConnectionManager::BadId);
 
+    /*!
+       Shutdown the ConnectionManager process.
+     */
+    void ShutdownWithExit();
+
+    /*!
+       Returns the PID of the connection manager
+     */
+    CORBA::Long getPID();
+
   private :
 
     struct connection_infos {
index f4cfd079716ce8484d445762fe8b486e4a7b1a61..ebd482b8dd229597f28d6eec6c1dc0ce1db2150a 100644 (file)
@@ -551,6 +551,16 @@ SALOME_ModuleCatalogImpl::GetComponentInfo(const char *name)
   return NULL;
 }
 
+CORBA::Long SALOME_ModuleCatalogImpl::getPID()
+{ 
+  return (CORBA::Long)getpid();
+}
+
+void SALOME_ModuleCatalogImpl::ShutdownWithExit()
+{
+  exit( EXIT_SUCCESS );
+}
+
 ParserComponent *
 SALOME_ModuleCatalogImpl::findComponent(const string & name)
 {
index 0768c5de776881a377c115885e9717ade830b5aa..4c9334c845144dd9235eec047be8d5a173b13af4 100644 (file)
@@ -104,6 +104,8 @@ public:
     GetComponentInfo(const char *name);
 
   void ping(){};
+  CORBA::Long getPID();
+  void ShutdownWithExit();
 
   void shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); };
 
index 16c0b736c119961522a91fde178016047d2a7c4f..52a3d1e9a75423b7ec2d9e44958d6291eed12e93 100644 (file)
@@ -265,3 +265,8 @@ void RegistryService::ping()
   MESSAGE(" RegistryService::ping() pid "<< _getpid());
 #endif
 }
+
+CORBA::Long RegistryService::getPID()
+{
+  return (CORBA::Long)getpid();
+}
index 4315f9321bb79c8ca2a1224b960fa743db5bdaa7..9b26f41f8b6357a5eb8b6766dfc5d310db3683d6 100644 (file)
@@ -72,6 +72,7 @@ public :
        virtual ~RegistryService(void);
 
         void ping();
+        CORBA::Long getPID();
        virtual CORBA::ULong add (const Registry::Infos & infos);
        virtual CORBA::ULong size ( void );
 #ifndef WNT
index 53b75016d921152fab6169a60e22e19cad246cc5..f06c882ba3a32cfee11065fcb46754cab9b7b4aa 100644 (file)
@@ -450,6 +450,20 @@ PortableServer::POA_ptr SALOMEDS_StudyManager_i::GetPOA(const SALOMEDS::Study_pt
   return PortableServer::POA::_nil();
 }
 
+CORBA::Long SALOMEDS_StudyManager_i::getPID()
+{ 
+#ifdef WIN32
+  return (CORBA::Long)_getpid();
+#else
+  return (CORBA::Long)getpid();
+#endif
+}
+
+void SALOMEDS_StudyManager_i::ShutdownWithExit()
+{
+  exit( EXIT_SUCCESS );
+}
+
 //===========================================================================
 //   PRIVATE FUNCTIONS
 //===========================================================================
index 2c85abb89e3f94d84eb2544e15e7cace84bbb98f..41118c5db6bb02f5ae3c32a5033e77d1beef4b4a 100644 (file)
 // std C++ headers
 #include <iostream>
 
+#ifndef WNT
+#include <unistd.h>
+#endif
+
 // IDL headers
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SALOMEDS)
@@ -136,6 +140,8 @@ public:
   virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };  
   
   void ping(){};
+  CORBA::Long getPID();
+  void ShutdownWithExit();
 
   virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
 
index 0a8ddf697a140f8f42e3dce4b9e3f528e316d42d..1cb869e1192e5f5250b6a1625772d15ebf00cffc 100644 (file)
@@ -41,7 +41,12 @@ ORB_INIT::~ORB_INIT()
   if ( ! CORBA::is_nil( _orb ) )
   {
     //std::cerr << "appel _orb->destroy()" << std::endl;
-    _orb->destroy() ;
+    try {
+      _orb->destroy() ;
+    }
+    catch(...) {
+      MESSAGE("Caught CORBA::Exception.");
+    }
     //std::cerr << "retour _orb->destroy()" << std::endl;
   }
 }