]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
IPAL20326 SALOME_Logger_Server is not killed
authordmv <dmv@opencascade.com>
Mon, 15 Dec 2008 10:41:27 +0000 (10:41 +0000)
committerdmv <dmv@opencascade.com>
Mon, 15 Dec 2008 10:41:27 +0000 (10:41 +0000)
idl/Logger.idl
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
src/Logger/SALOME_Logger_Server.hxx
src/Logger/SALOME_Logger_Server_main.cxx

index b452c82b3ed9b12709b37d9b50940bf0c354ebd6..e69d5f2dd1ebe503aab60dd787dfc908bd1319c2 100644 (file)
@@ -34,6 +34,7 @@ module SALOME_Logger
            //put message into one special place for all servers using Logger
            oneway void putMessage (in string message);
             void ping (); 
+            void shutdown();
          };
 };
 
index e507a0373a21f09e1218ff633e36ed0eede4f545..70f920c7c2f24095d0a88ca75fc00211d7a40c8b 100644 (file)
@@ -46,6 +46,7 @@
 #include CORBA_CLIENT_HEADER(DSC_Engines)
 #include CORBA_CLIENT_HEADER(SALOME_Registry)
 #include CORBA_CLIENT_HEADER(SALOMEDS)
+#include CORBA_CLIENT_HEADER(Logger)
 
 #include "SALOME_ContainerManager.hxx"
 #include "SALOME_Component_i.hxx"
@@ -476,6 +477,42 @@ void SALOME_LifeCycleCORBA::shutdownServers()
   Registry::Components_var registry = Registry::Components::_narrow(objR);
   if ( !CORBA::is_nil(registry) && ( pid != registry->getPID() ) )
       registry->Shutdown();
+
+  // 6) Logger
+  int argc = 0;
+  char *xargv = (char*)"";
+  char **argv = &xargv;
+  CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+
+  CORBA::Object_var objLog = CORBA::Object::_nil();
+  CosNaming::NamingContext_var inc;
+  CORBA::Object_var theObj = CORBA::Object::_nil();
+  std::string stdname = "Logger";
+  CosNaming::Name name;
+  name.length(1);
+  name[0].id = CORBA::string_dup(stdname.c_str());
+  try
+    { 
+      if(!CORBA::is_nil(orb)) 
+       theObj = orb->resolve_initial_references("NameService");
+      if (!CORBA::is_nil(theObj))
+       inc = CosNaming::NamingContext::_narrow(theObj);
+    }
+  catch(...)
+    {
+    }
+  if(!CORBA::is_nil(inc)) {
+    try
+      {
+       objLog = inc->resolve(name);
+       SALOME_Logger::Logger_var logger = SALOME_Logger::Logger::_narrow(objLog);
+       if ( !CORBA::is_nil(logger) )
+         logger->shutdown();
+      }
+    catch(...)
+      {
+      }
+  }
 }
 
 //=============================================================================
index ad662749ccd068ee127aa39d36a06c1f1541df94..159d222157bb75aa8cd7b1a4fd86adc31a280eef 100644 (file)
@@ -61,6 +61,8 @@ public:
        //put message into one special place for all servers
        void putMessage(const char* message);
         void ping();
+        void SetOrb( CORBA::ORB_ptr orb ) { _orb = CORBA::ORB::_duplicate(orb); return; }
+       void shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); };  
 private:
        //if m_putIntoFile is true all messages will be put into special 
        //otherwise all messages will be put into terminal via cout 
@@ -70,6 +72,8 @@ private:
 
        //synchronisation object
        static omni_mutex myLock;
+
+       CORBA::ORB_ptr _orb;
 };
 
 #endif // !defined(SALOME_Logger_Server_include)
index f0f2b6c9e83a7ea619fd9b0decbd06865d284e1a..722ee446f01e756bbc341d7fbf5f3586adfc1826 100644 (file)
@@ -103,6 +103,7 @@ int main(int argc, char **argv)
       else
                  myLogger = new Logger(argv[1]);
 
+      myLogger->SetOrb(orb);
       myLoggerRef = myLogger->_this();
       CosNaming::Name name;
       name.length(1);