return CORBA::string_dup(_name.c_str());
}
-void SALOME_ExternalServerHandler::killMe()
+void SALOME_ExternalServerHandler::KillPID(long pid)
{
#ifndef WIN32
- kill(_pid,SIGTERM);//SIGTERM is emitted not SIGKILL to give _pid process a chance to trap it.
+ kill(pid,SIGTERM);//SIGTERM is emitted not SIGKILL to give _pid process a chance to trap it.
#endif
}
+void SALOME_ExternalServerHandler::killMe()
+{
+ KillPID(_pid);
+}
+
void SALOME_ExternalServerHandler::ping()
{
#ifndef WIN32
SALOME_ExternalServerHandler(SALOME_ExternalServerLauncher *boss, const std::string& name, SALOME_NamingService *ns, long pid);
virtual ~SALOME_ExternalServerHandler();
void registerToKill(const SALOME_CPythonHelper *pyHelper) const;
+ static void KillPID(long pid);
public:
CORBA::Long getPID() override;
char *getName() override;
#include <memory>
#include <functional>
-constexpr char NAME_IN_NS[]="/ExternalServers";
+const char SALOME_ExternalServerLauncher::NAME_IN_NS[]="/ExternalServers";
unsigned SALOME_ExternalServerLauncher::CNT = 0;
std::ostringstream oss;
oss << "Custom_"<< server_name << "_" << CNT++;
_pyHelper->registerToSalomePiDict(oss.str(),PID);
+ _list_of_pids_to_kill.push_back(PID);
}
void SALOME_ExternalServerLauncher::cleanServersInNS()
void SALOME_ExternalServerLauncher::shutdownServers()
{
+ for(auto pid : this->_list_of_pids_to_kill)
+ {
+ SALOME_ExternalServerHandler::KillPID(pid);
+ }
+ //
std::vector<std::string> lioes(ListOfExternalServersCpp(_NS));
for(auto servName : lioes)
{
SALOME_NamingService *_NS = nullptr;
PortableServer::POA_var _poa;
static unsigned CNT;
+ std::vector<long> _list_of_pids_to_kill;
+ public:
+ static const char NAME_IN_NS[];
};
${CMAKE_CURRENT_SOURCE_DIR}/../Batch
${CMAKE_CURRENT_SOURCE_DIR}/../Notification
${CMAKE_CURRENT_SOURCE_DIR}/../Registry
+ ${CMAKE_CURRENT_SOURCE_DIR}/../Launcher
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMESDS
${PROJECT_BINARY_DIR}/idl
)
SALOMEBasics
SalomeGenericObj
SalomeIDLKernel
+ SalomeLauncher
)
ADD_DEFINITIONS(${OMNIORB_DEFINITIONS})
#include "SALOME_LifeCycleCORBA.hxx"
#include "SALOME_ResourcesManager.hxx"
#include "SALOMESDS_DataServerManager.hxx"
+#include "SALOME_ExternalServerLauncher.hxx"
#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
#include CORBA_CLIENT_HEADER(SALOME_Session)
#ifndef WIN32
nanosleep(&ts_req,0);
#endif
- // 4 ) Remote ScopeServer (the DataServer is hosted by SalomeLauncher shutdown right after)
+ // 4 ) Remote ScopeServer (the DataServer is hosted by SalomeLauncher shutdown right after on point 6)
try
{
CORBA::Object_var objDSM(_NS->Resolve(SALOMESDS::DataServerManager::NAME_IN_NS));
{
// ignore and continue
}
-
- // 5) SalomeLauncher
+ // 5) External server launcher (the ExternalServer is hosted by SalomeLauncher shutdown right after on point 6)
+ try
+ {
+ CORBA::Object_var objDSM(_NS->Resolve(SALOME_ExternalServerLauncher::NAME_IN_NS));
+ SALOME::ExternalServerLauncher_var dsm(SALOME::ExternalServerLauncher::_narrow(objDSM));
+ if ( !CORBA::is_nil(dsm) )
+ dsm->shutdownServers();
+ }
+ catch(const CORBA::Exception& e)
+ {
+ // ignore and continue
+ }
+ // 6) SalomeLauncher
try
{
if(shutdownLauncher){