-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <ServiceUnreachable.hxx>
#include "SALOME_LifeCycleCORBA.hxx"
+#include "SALOME_ResourcesManager.hxx"
+#include "SALOMESDS_DataServerManager.hxx"
+
#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
#include CORBA_CLIENT_HEADER(SALOME_Session)
#include CORBA_CLIENT_HEADER(DSC_Engines)
#include CORBA_CLIENT_HEADER(SALOME_Registry)
#include CORBA_CLIENT_HEADER(SALOMEDS)
+#include CORBA_CLIENT_HEADER(SALOME_SDS)
#include CORBA_CLIENT_HEADER(Logger)
#include CORBA_CLIENT_HEADER(SALOME_Launcher)
+#include "SALOME_ResourcesManager.hxx"
#include "SALOME_ContainerManager.hxx"
#include "SALOME_Component_i.hxx"
#include "SALOME_NamingService.hxx"
}
IncompatibleComponent::IncompatibleComponent(const IncompatibleComponent &ex):
- SALOME_Exception( ex )
+ SALOME_Exception( ex )
{
}
*/
//=============================================================================
-/*!
+/*!
* Constructor
*/
//=============================================================================
}
else _NS = ns;
//add try catch
- _NS->Change_Directory("/"); // mpv 250105: current directory may be not root
+ _NS->Change_Directory("/"); // mpv 250105: current directory may be not root
// (in SALOMEDS for an example)
// not enough: set a current directory in naming service is not thread safe
// if naming service instance is shared among several threads...
}
//=============================================================================
-/*!
+/*!
* Destructor
*/
//=============================================================================
// containerName doesn't contain "/" => Local container
params.container_name = CORBA::string_dup(stContainer);
}
- else
+ else
{
stContainer[rg]='\0';
params.container_name = CORBA::string_dup(stContainer+rg+1);
try
{
CORBA::Object_var obj = _NS->Resolve("/Kernel/ModulCatalog");
- SALOME_ModuleCatalog::ModuleCatalog_var Catalog =
+ SALOME_ModuleCatalog::ModuleCatalog_var Catalog =
SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj) ;
ASSERT(! CORBA::is_nil(Catalog));
- SALOME_ModuleCatalog::Acomponent_var compoInfo =
+ SALOME_ModuleCatalog::Acomponent_var compoInfo =
Catalog->GetComponent(componentName);
- if (CORBA::is_nil (compoInfo))
+ if (CORBA::is_nil (compoInfo))
{
MESSAGE("Catalog Error: Component not found in the catalog " << componentName);
return false;
*/
//=============================================================================
-void
+void
SALOME_LifeCycleCORBA::preSet(Engines::ResourceParameters& params)
{
params.name = "";
}
//=============================================================================
-/*!
+/*!
* \return a number of processors not 0, only for MPI containers
*/
//=============================================================================
}
//=============================================================================
-/*! \brief shutdown all the SALOME servers except SALOME_Session_Server, omniNames and notifd
+/*! \brief shutdown all the SALOME servers except SALOME_Session_Server and omniNames
*/
//=============================================================================
{
// get each Container from NamingService => shutdown it
// (the order is inverse to the order of servers initialization)
-
+
SALOME::Session_var session = SALOME::Session::_nil();
CORBA::Long pid = 0;
CORBA::Object_var objS = _NS->Resolve("/Kernel/Session");
}
std::string hostname = Kernel_Utils::GetHostname();
-
+
// 1) ConnectionManager
try
{
#ifndef WIN32
nanosleep(&ts_req,0);
#endif
+ // 4 ) Remote ScopeServer (the DataServer is hosted by SalomeLauncher shutdown right after)
+ try
+ {
+ CORBA::Object_var objDSM(_NS->Resolve(SALOMESDS::DataServerManager::NAME_IN_NS));
+ SALOME::DataServerManager_var dsm(SALOME::DataServerManager::_narrow(objDSM));
+ if ( !CORBA::is_nil(dsm) )
+ dsm->shutdownScopes();
+ }
+ catch(const CORBA::Exception& e)
+ {
+ // ignore and continue
+ }
- // 4) SalomeLauncher
+ // 5) SalomeLauncher
try
{
CORBA::Object_var objSL = _NS->Resolve("/SalomeLauncher");
{
// ignore and continue
}
-
+
//Wait some time so that launcher be completely shutdown
#ifndef WIN32
nanosleep(&ts_req,0);
#endif
- // 5) Registry
+ // 6) Registry
try
{
CORBA::Object_var objR = _NS->Resolve("/Registry");
// ignore and continue
}
- /*
- // 6) Session
- if ( !CORBA::is_nil( session ) ) {
- try
- {
- session->Shutdown();
- }
- catch(const CORBA::Exception& e)
- {
- // ignore and continue
- }
- }
- */
-
// 7) Logger
int argc = 0;
char *xargv = (char*)"";
name.length(1);
name[0].id = CORBA::string_dup(stdname.c_str());
try
- {
- if(!CORBA::is_nil(orb))
+ {
+ 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))
+ if(!CORBA::is_nil(inc))
{
try
{
}
//=============================================================================
-/*! \brief shutdown omniNames and notifd
+/*! \brief shutdown omniNames
*/
//=============================================================================
void SALOME_LifeCycleCORBA::killOmniNames()
{
std::string portNumber (::getenv ("NSPORT") );
- if ( !portNumber.empty() )
+ std::string python_exe;
+
+ python_exe = std::string("python");
+#ifdef WIN32
+ #ifdef _DEBUG_
+ python_exe += std::string("_d");
+ #endif
+#endif
+
+ if ( !portNumber.empty() )
{
-#ifdef WNT
-#else
- std::string cmd ;
- cmd = std::string( "ps -eo pid,command | grep -v grep | grep -E \"omniNames.*")
- + portNumber
- + std::string("\" | awk '{cmd=sprintf(\"kill -9 %s\",$1); system(cmd)}'" );
+ std::string cmd = ("from salome_utils import killOmniNames; ");
+ cmd += std::string("killOmniNames(") + portNumber + "); ";
+ cmd = python_exe + std::string(" -c \"") + cmd +"\"";
MESSAGE(cmd);
- try {
- system ( cmd.c_str() );
- }
- catch ( ... ) {
- }
-#endif
+ system( cmd.c_str() );
+
+ cmd = ("from killSalomeWithPort import cleanApplication; ");
+ cmd += std::string("cleanApplication(") + portNumber + "); ";
+ //cmd = python_exe + std::string(" -c \"") + cmd +"\" > /dev/null 2> /dev/null";
+ cmd = python_exe + std::string(" -c \"") + cmd +"\"";
+ MESSAGE(cmd);
+ system( cmd.c_str() );
}
-
- // NPAL 18309 (Kill Notifd)
- if ( !portNumber.empty() )
+
+#ifdef WITH_PORTMANAGER
+ // shutdown portmanager
+ if ( !portNumber.empty() )
{
- std::string cmd = ("from killSalomeWithPort import killNotifdAndClean; ");
- cmd += std::string("killNotifdAndClean(") + portNumber + "); ";
- cmd = std::string("python -c \"") + cmd +"\" > /dev/null 2> /dev/null";
+ std::string cmd = ("from PortManager import releasePort; ");
+ cmd += std::string("releasePort(") + portNumber + "); ";
+ //cmd = python_exe + std::string(" -c \"") + cmd +"\" > /dev/null 2> /dev/null";
+ cmd = python_exe + std::string(" -c \"") + cmd +"\"";
MESSAGE(cmd);
system( cmd.c_str() );
}
+#endif
}
//=============================================================================
*/
//=============================================================================
-Engines::EngineComponent_ptr
+Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::
-_LoadComponent(const Engines::ContainerParameters& params,
+_LoadComponent(const Engines::ContainerParameters& params,
const char *componentName,
int studyId)
{
char* reason;
bool isLoadable = cont->load_component_Library(componentName,reason);
- if (!isLoadable)
+ if (!isLoadable)
{
//std::cerr << reason << std::endl;
CORBA::string_free(reason);