Salome HOME
projects
/
modules
/
kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update copyrights
[modules/kernel.git]
/
src
/
LifeCycleCORBA
/
SALOME_LifeCycleCORBA.cxx
diff --git
a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
index 5473178da525278f28f4993c0122704ada775414..a6f1d9a5745c4b4224e4f815fae1ebe14bc4f089 100644
(file)
--- a/
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
+++ b/
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-201
4
CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-201
9
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
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@
-42,11
+42,15
@@
#include <ServiceUnreachable.hxx>
#include "SALOME_LifeCycleCORBA.hxx"
#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_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 CORBA_CLIENT_HEADER(Logger)
#include CORBA_CLIENT_HEADER(SALOME_Launcher)
@@
-98,7
+102,7
@@
SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService *ns)
// (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...
// (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...
- // ==> al
lways use absolute path and do
t rely on current directory!
+ // ==> al
ways use absolute path and don'
t rely on current directory!
CORBA::Object_var obj =
_NS->Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
CORBA::Object_var obj =
_NS->Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
@@
-128,14
+132,12
@@
SALOME_LifeCycleCORBA::~SALOME_LifeCycleCORBA()
*
* \param params container parameters like type or name...
* \param componentName the name of component class
*
* \param params container parameters like type or name...
* \param componentName the name of component class
- * \param studyId default = 0 : multistudy instance
* \return a CORBA reference of the component instance, or _nil if not found
*/
//=============================================================================
Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::FindComponent(const Engines::ContainerParameters& params,
* \return a CORBA reference of the component instance, or _nil if not found
*/
//=============================================================================
Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::FindComponent(const Engines::ContainerParameters& params,
- const char *componentName,
- int studyId)
+ const char *componentName)
{
if (! isKnownComponentClass(componentName))
return Engines::EngineComponent::_nil();
{
if (! isKnownComponentClass(componentName))
return Engines::EngineComponent::_nil();
@@
-156,7
+158,6
@@
SALOME_LifeCycleCORBA::FindComponent(const Engines::ContainerParameters& params,
Engines::EngineComponent_var compo = _FindComponent(new_params,
componentName,
Engines::EngineComponent_var compo = _FindComponent(new_params,
componentName,
- studyId,
listOfResources);
return compo._retn();
listOfResources);
return compo._retn();
@@
-167,15
+168,13
@@
SALOME_LifeCycleCORBA::FindComponent(const Engines::ContainerParameters& params,
*
* \param params container parameters like type or name...
* \param componentName the name of component class
*
* \param params container parameters like type or name...
* \param componentName the name of component class
- * \param studyId default = 0 : multistudy instance
* \return a CORBA reference of the component instance, or _nil if problem
*/
//=============================================================================
Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::LoadComponent(const Engines::ContainerParameters& params,
* \return a CORBA reference of the component instance, or _nil if problem
*/
//=============================================================================
Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::LoadComponent(const Engines::ContainerParameters& params,
- const char *componentName,
- int studyId)
+ const char *componentName)
{
// --- Check if Component Name is known in ModuleCatalog
{
// --- Check if Component Name is known in ModuleCatalog
@@
-199,8
+198,7
@@
SALOME_LifeCycleCORBA::LoadComponent(const Engines::ContainerParameters& params,
new_params.resource_params.resList = listOfResources;
Engines::EngineComponent_var compo = _LoadComponent(new_params,
new_params.resource_params.resList = listOfResources;
Engines::EngineComponent_var compo = _LoadComponent(new_params,
- componentName,
- studyId);
+ componentName);
return compo._retn();
}
return compo._retn();
}
@@
-211,7
+209,6
@@
SALOME_LifeCycleCORBA::LoadComponent(const Engines::ContainerParameters& params,
*
* \param params container parameters like type or name...
* \param componentName the name of component class
*
* \param params container parameters like type or name...
* \param componentName the name of component class
- * \param studyId default = 0 : multistudy instance
* \return a CORBA reference of the component instance, or _nil if problem
*/
//=============================================================================
* \return a CORBA reference of the component instance, or _nil if problem
*/
//=============================================================================
@@
-219,8
+216,7
@@
SALOME_LifeCycleCORBA::LoadComponent(const Engines::ContainerParameters& params,
Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::
FindOrLoad_Component(const Engines::ContainerParameters& params,
Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::
FindOrLoad_Component(const Engines::ContainerParameters& params,
- const char *componentName,
- int studyId)
+ const char *componentName)
{
// --- Check if Component Name is known in ModuleCatalog
{
// --- Check if Component Name is known in ModuleCatalog
@@
-243,16
+239,14
@@
FindOrLoad_Component(const Engines::ContainerParameters& params,
}
Engines::EngineComponent_var compo = _FindComponent(new_params,
}
Engines::EngineComponent_var compo = _FindComponent(new_params,
- componentName,
- studyId,
- listOfResources);
+ componentName,
+ listOfResources);
if(CORBA::is_nil(compo))
{
new_params.resource_params.resList = listOfResources;
compo = _LoadComponent(new_params,
if(CORBA::is_nil(compo))
{
new_params.resource_params.resList = listOfResources;
compo = _LoadComponent(new_params,
- componentName,
- studyId);
+ componentName);
}
return compo._retn();
}
return compo._retn();
@@
-471,10
+465,10
@@
void SALOME_LifeCycleCORBA::shutdownServers()
// 2) SALOMEDS
try
{
// 2) SALOMEDS
try
{
- CORBA::Object_var objSDS = _NS->Resolve("/
myStudyManager
");
- SALOMEDS::Study
Manager_var studyManager = SALOMEDS::StudyManager
::_narrow(objSDS) ;
- if ( !CORBA::is_nil(study
Manager) && ( pid != studyManager
->getPID() ) )
- study
Manager
->Shutdown();
+ CORBA::Object_var objSDS = _NS->Resolve("/
Study
");
+ SALOMEDS::Study
_var study = SALOMEDS::Study
::_narrow(objSDS) ;
+ if ( !CORBA::is_nil(study
) && ( pid != study
->getPID() ) )
+ study->Shutdown();
}
catch(const CORBA::Exception& e)
{
}
catch(const CORBA::Exception& e)
{
@@
-503,8
+497,20
@@
void SALOME_LifeCycleCORBA::shutdownServers()
#ifndef WIN32
nanosleep(&ts_req,0);
#endif
#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");
try
{
CORBA::Object_var objSL = _NS->Resolve("/SalomeLauncher");
@@
-522,7
+528,7
@@
void SALOME_LifeCycleCORBA::shutdownServers()
nanosleep(&ts_req,0);
#endif
nanosleep(&ts_req,0);
#endif
- //
5
) Registry
+ //
6
) Registry
try
{
CORBA::Object_var objR = _NS->Resolve("/Registry");
try
{
CORBA::Object_var objR = _NS->Resolve("/Registry");
@@
-535,20
+541,6
@@
void SALOME_LifeCycleCORBA::shutdownServers()
// ignore and continue
}
// 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*)"";
// 7) Logger
int argc = 0;
char *xargv = (char*)"";
@@
-595,54
+587,38
@@
void SALOME_LifeCycleCORBA::shutdownServers()
void SALOME_LifeCycleCORBA::killOmniNames()
{
std::string portNumber (::getenv ("NSPORT") );
void SALOME_LifeCycleCORBA::killOmniNames()
{
std::string portNumber (::getenv ("NSPORT") );
- if ( !portNumber.empty() )
- {
-#ifdef WIN32
-#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)}'" );
- MESSAGE(cmd);
- try {
- system ( cmd.c_str() );
- }
- catch ( ... ) {
- }
-#endif
- }
-
std::string python_exe;
std::string python_exe;
- python_exe = std::string("python");
-#ifdef WIN32
- #ifdef _DEBUG_
- python_exe += std::string("_d");
- #endif
-#endif
+ python_exe = std::string("python3");
if ( !portNumber.empty() )
{
if ( !portNumber.empty() )
{
- std::string cmd = ("from killSalomeWithPort import cleanApplication; ");
+ std::string cmd;
+
+ cmd = std::string("from salome_utils import killOmniNames; ");
+ cmd += std::string("killOmniNames(") + portNumber + "); ";
+ cmd = python_exe + std::string(" -c \"") + cmd +"\"";
+ MESSAGE(cmd);
+ system( cmd.c_str() );
+
+ cmd = std::string("from killSalomeWithPort import cleanApplication; ");
cmd += std::string("cleanApplication(") + portNumber + "); ";
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() );
}
cmd = python_exe + std::string(" -c \"") + cmd +"\"";
MESSAGE(cmd);
system( cmd.c_str() );
}
-#ifdef WITH_PORTMANAGER
// shutdown portmanager
if ( !portNumber.empty() )
{
// shutdown portmanager
if ( !portNumber.empty() )
{
- std::string cmd = ("from PortManager import releasePort; ");
+ std::string cmd;
+
+ cmd = std::string("from PortManager import releasePort; ");
cmd += std::string("releasePort(") + portNumber + "); ";
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() );
}
cmd = python_exe + std::string(" -c \"") + cmd +"\"";
MESSAGE(cmd);
system( cmd.c_str() );
}
-#endif
}
//=============================================================================
}
//=============================================================================
@@
-653,7
+629,6
@@
void SALOME_LifeCycleCORBA::killOmniNames()
*
* \param params machine parameters like type or name...
* \param componentName the name of component class
*
* \param params machine parameters like type or name...
* \param componentName the name of component class
- * \param studyId default = 0 : multistudy instance
* \param listOfMachines list of machine address
* \return a CORBA reference of the component instance, or _nil if not found
*/
* \param listOfMachines list of machine address
* \return a CORBA reference of the component instance, or _nil if not found
*/
@@
-663,7
+638,6
@@
Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::
_FindComponent(const Engines::ContainerParameters& params,
const char *componentName,
SALOME_LifeCycleCORBA::
_FindComponent(const Engines::ContainerParameters& params,
const char *componentName,
- int studyId,
const Engines::ResourceList& listOfResources)
{
// --- build the list of machines on which the component is already running
const Engines::ResourceList& listOfResources)
{
// --- build the list of machines on which the component is already running
@@
-714,7
+688,6
@@
_FindComponent(const Engines::ContainerParameters& params,
*
* \param params machine parameters like type or name...
* \param componentName the name of component class
*
* \param params machine parameters like type or name...
* \param componentName the name of component class
- * \param studyId default = 0 : multistudy instance
* \return a CORBA reference of the component instance, or _nil if problem
*/
//=============================================================================
* \return a CORBA reference of the component instance, or _nil if problem
*/
//=============================================================================
@@
-722,8
+695,7
@@
_FindComponent(const Engines::ContainerParameters& params,
Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::
_LoadComponent(const Engines::ContainerParameters& params,
Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::
_LoadComponent(const Engines::ContainerParameters& params,
- const char *componentName,
- int studyId)
+ const char *componentName)
{
MESSAGE("_LoadComponent, required " << params.container_name <<
" " << componentName << " " << NbProc(params));
{
MESSAGE("_LoadComponent, required " << params.container_name <<
" " << componentName << " " << NbProc(params));
@@
-744,7
+716,7
@@
_LoadComponent(const Engines::ContainerParameters& params,
CORBA::string_free(reason);
Engines::EngineComponent_var myInstance =
CORBA::string_free(reason);
Engines::EngineComponent_var myInstance =
- cont->create_component_instance(componentName
, studyId
);
+ cont->create_component_instance(componentName);
return myInstance._retn();
}
return myInstance._retn();
}
@@
-753,14
+725,12
@@
_LoadComponent(const Engines::ContainerParameters& params,
*
* \param params machine parameters like type or name...
* \param componentName the name of component class
*
* \param params machine parameters like type or name...
* \param componentName the name of component class
- * \param studyId default = 0 : multistudy instance
* \return a CORBA reference of the parallel component instance, or _nil if problem
*/
//=============================================================================
Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::Load_ParallelComponent(const Engines::ContainerParameters& params,
* \return a CORBA reference of the parallel component instance, or _nil if problem
*/
//=============================================================================
Engines::EngineComponent_ptr
SALOME_LifeCycleCORBA::Load_ParallelComponent(const Engines::ContainerParameters& params,
- const char *componentName,
- int studyId)
+ const char *componentName)
{
MESSAGE("Entering LoadParallelComponent");
{
MESSAGE("Entering LoadParallelComponent");
@@
-796,7
+766,7
@@
SALOME_LifeCycleCORBA::Load_ParallelComponent(const Engines::ContainerParameters
// @PARALLEL@ permits to identify that the component requested
// is a parallel component.
std::string name = std::string(componentName);
// @PARALLEL@ permits to identify that the component requested
// is a parallel component.
std::string name = std::string(componentName);
- Engines::EngineComponent_var myInstance = cont->create_component_instance(name.c_str()
, studyId
);
+ Engines::EngineComponent_var myInstance = cont->create_component_instance(name.c_str());
if (CORBA::is_nil(myInstance))
INFOS("create_component_instance returns a NULL component !");
return myInstance._retn();
if (CORBA::is_nil(myInstance))
INFOS("create_component_instance returns a NULL component !");
return myInstance._retn();