]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
IPAL20326 SALOME_Logger_Server is not killed
authordmv <dmv@opencascade.com>
Tue, 25 Nov 2008 09:31:37 +0000 (09:31 +0000)
committerdmv <dmv@opencascade.com>
Tue, 25 Nov 2008 09:31:37 +0000 (09:31 +0000)
idl/Logger.idl
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
src/Logger/SALOME_Logger_Server.hxx
src/Logger/SALOME_Logger_Server_main.cxx

index 6b3ba9d005baaa611db57697f26be00a7e53c87a..5574dcb9c5c965ed63bfa9d5d5e5fbb7f8275ac6 100644 (file)
@@ -17,7 +17,8 @@ module SALOME_Logger
          {
            //put message into one special place for all servers using Logger
            oneway void putMessage (in string message);
-            void ping (); 
+            void ping ();
+            void shutdown();
          };
 };
 
index a909068f726da07c509c2883312348cf5610a64b..cd6c3cb0d2f2400df6704b1cb25c05fd7c1c7cad 100644 (file)
@@ -47,6 +47,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"
@@ -477,6 +478,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 f1e1a8e911c7bc00f289f692421c7ba0ebc45e9a..6ca3a73e4b44717a08b76e88cec7d203cc609364 100644 (file)
@@ -45,6 +45,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 
@@ -53,6 +55,7 @@ private:
        std::ofstream m_outputFile; 
        //synchronisation object
        static omni_mutex myLock;
+       CORBA::ORB_ptr _orb;
 };
 
 #endif // !defined(SALOME_Logger_Server_include)
index 5c711f1b5b96c5d8243abd86a121dde130b8f4ab..946997d04ce183f4b377db7e7568f2277c0769f5 100644 (file)
@@ -86,6 +86,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);