From: dmv Date: Tue, 25 Nov 2008 09:31:37 +0000 (+0000) Subject: IPAL20326 SALOME_Logger_Server is not killed X-Git-Tag: V5_1_0rc2~24 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5d8526abacfa38abd52d279293c1ee6324551eb7;p=modules%2Fkernel.git IPAL20326 SALOME_Logger_Server is not killed --- diff --git a/idl/Logger.idl b/idl/Logger.idl index 6b3ba9d00..5574dcb9c 100644 --- a/idl/Logger.idl +++ b/idl/Logger.idl @@ -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(); }; }; diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index a909068f7..cd6c3cb0d 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -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(...) + { + } + } } //============================================================================= diff --git a/src/Logger/SALOME_Logger_Server.hxx b/src/Logger/SALOME_Logger_Server.hxx index f1e1a8e91..6ca3a73e4 100644 --- a/src/Logger/SALOME_Logger_Server.hxx +++ b/src/Logger/SALOME_Logger_Server.hxx @@ -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) diff --git a/src/Logger/SALOME_Logger_Server_main.cxx b/src/Logger/SALOME_Logger_Server_main.cxx index 5c711f1b5..946997d04 100644 --- a/src/Logger/SALOME_Logger_Server_main.cxx +++ b/src/Logger/SALOME_Logger_Server_main.cxx @@ -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);