From: dmv Date: Mon, 15 Dec 2008 10:41:27 +0000 (+0000) Subject: IPAL20326 SALOME_Logger_Server is not killed X-Git-Tag: V4_1_0_maintainance_FINAL~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=71e801af4e898fa6d6081130d4470efdb80d7153;p=modules%2Fkernel.git IPAL20326 SALOME_Logger_Server is not killed --- diff --git a/idl/Logger.idl b/idl/Logger.idl index b452c82b3..e69d5f2dd 100644 --- a/idl/Logger.idl +++ b/idl/Logger.idl @@ -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(); }; }; diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index e507a0373..70f920c7c 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -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(...) + { + } + } } //============================================================================= diff --git a/src/Logger/SALOME_Logger_Server.hxx b/src/Logger/SALOME_Logger_Server.hxx index ad662749c..159d22215 100644 --- a/src/Logger/SALOME_Logger_Server.hxx +++ b/src/Logger/SALOME_Logger_Server.hxx @@ -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) diff --git a/src/Logger/SALOME_Logger_Server_main.cxx b/src/Logger/SALOME_Logger_Server_main.cxx index f0f2b6c9e..722ee446f 100644 --- a/src/Logger/SALOME_Logger_Server_main.cxx +++ b/src/Logger/SALOME_Logger_Server_main.cxx @@ -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);