]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
destroy connection mananger in naming service at shutdown
authorBernard Secher <bernard.secher@cea.fr>
Wed, 28 Nov 2018 07:55:25 +0000 (08:55 +0100)
committerBernard Secher <bernard.secher@cea.fr>
Thu, 28 Mar 2019 13:17:10 +0000 (14:17 +0100)
src/DSC/DSC_Basic/ConnectionManager_i.cxx
src/DSC/DSC_Basic/ConnectionManager_i.hxx

index 90a5943cfc406110e0e222541ee4c267afc2d3dc..eda264295df9600bbf3fbba9dc7348642cdb7373 100644 (file)
@@ -25,7 +25,6 @@
 //  Module : KERNEL
 //
 #include "ConnectionManager_i.hxx"
-#include "SALOME_NamingService.hxx"
 
 #ifdef WIN32
 # include <process.h>
 # include <unistd.h>
 #endif
 
+const char * ConnectionManager_i::_ConnectionManagerNameInNS = "/ConnectionManager";
+
 ConnectionManager_i::ConnectionManager_i(CORBA::ORB_ptr orb) {
   _orb = CORBA::ORB::_duplicate(orb) ;
-  SALOME_NamingService * ns = new SALOME_NamingService(orb);
-  const char * ConnectionManagerNameInNS = "/ConnectionManager";
+  _NS = new SALOME_NamingService(orb);
   CORBA::Object_var obref = _this();
   _remove_ref();
-  ns->Register(obref, ConnectionManagerNameInNS);
-  delete ns;
+  _NS->Register(obref, _ConnectionManagerNameInNS);
 
   current_id = 0;
   pthread_mutex_init(&mutex, NULL);
 }
 
-ConnectionManager_i::~ConnectionManager_i() {}
+ConnectionManager_i::~ConnectionManager_i()
+{
+  delete _NS;
+}
 
 Engines::ConnectionManager::connectionId
 ConnectionManager_i::connect(Engines::DSC_ptr uses_component, 
@@ -122,6 +124,7 @@ ConnectionManager_i::disconnect(Engines::ConnectionManager::connectionId id,
 void
 ConnectionManager_i::ShutdownWithExit()
 {
+  _NS->Destroy_Name(_ConnectionManagerNameInNS);
   ids_it = ids.begin();
   while(ids_it != ids.end())
     {
index e3f6f24ce88b80c57c3865bb4f00c54afee2a9c7..84c7c94f68cab5605fef2843cc275e68f740321d 100644 (file)
@@ -28,6 +28,7 @@
 #define _CONNECTION_MANAGER_I_HXX_
 
 #include "DSC_Basic.hxx"
+#include "SALOME_NamingService.hxx"
 
 #include <iostream>
 #include <map>
@@ -74,6 +75,8 @@ class ConnectionManager_i :
      */
     CORBA::Long getPID();
 
+    static const char *_ConnectionManagerNameInNS;
+
   private :
 
     struct connection_infos {
@@ -96,6 +99,7 @@ class ConnectionManager_i :
     pthread_mutex_t mutex;
   protected:
     CORBA::ORB_var _orb;
+    SALOME_NamingService * _NS;
 };
 
 #endif