Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
@@ -23,17 +23,16 @@ namespace RoutingService
|
||||
Connection::Connection(const dds::domain::DomainParticipant &domainParticipant,
|
||||
const std::string &partition,
|
||||
const std::vector<TopicDispatcherInterface *> &topicsToRoute,
|
||||
const std::string &desc)
|
||||
: m_output(nullptr)
|
||||
const std::string &desc) : m_output(nullptr)
|
||||
, m_domainParticipant(domainParticipant)
|
||||
, m_publisher(new DDSConnector::Publisher(domainParticipant, partition))
|
||||
, m_subscriber(new DDSConnector::Subscriber(domainParticipant, partition, false))
|
||||
, m_dataWriterTask(nullptr)
|
||||
, m_topicsToRoute(topicsToRoute)
|
||||
, m_partition(partition)
|
||||
, m_description(desc)
|
||||
{
|
||||
INFO_LOG() << "Create connection: " << partition
|
||||
, m_description(desc),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
INFO_LOG(m_logger) << "Create connection: " << partition
|
||||
<< ", domain: " << domainParticipant.domain_id()
|
||||
<< ", direction: " << m_description
|
||||
<< " (" << this << ")";
|
||||
@@ -50,7 +49,7 @@ Connection::~Connection()
|
||||
}
|
||||
catch (const dds::core::Exception &ex)
|
||||
{
|
||||
ERROR_LOG() << "sub close ex: " << ex.what();
|
||||
ERROR_LOG(m_logger) << "sub close ex: " << ex.what();
|
||||
}
|
||||
m_subscriber = nullptr;
|
||||
try
|
||||
@@ -60,7 +59,7 @@ Connection::~Connection()
|
||||
}
|
||||
catch (const dds::core::Exception &ex)
|
||||
{
|
||||
ERROR_LOG() << "pub close ex: " << ex.what();
|
||||
ERROR_LOG(m_logger) << "pub close ex: " << ex.what();
|
||||
}
|
||||
m_publisher = nullptr;
|
||||
m_domainParticipant = nullptr;
|
||||
@@ -76,7 +75,7 @@ void Connection::setOutput(Connection *output)
|
||||
|
||||
bool Connection::initialize()
|
||||
{
|
||||
DEBUG_LOG() << "initialize new connection for " << m_partition
|
||||
DEBUG_LOG(m_logger) << "initialize new connection for " << m_partition
|
||||
<< ", direction: " << m_description
|
||||
<< " (" << this << ")";
|
||||
|
||||
@@ -87,7 +86,7 @@ bool Connection::initialize()
|
||||
|
||||
if (!m_output)
|
||||
{
|
||||
ERROR_LOG() << "Error initializing connection for " << m_partition
|
||||
ERROR_LOG(m_logger) << "Error initializing connection for " << m_partition
|
||||
<< ", direction: " << m_description << " - no output set!";
|
||||
return false;
|
||||
}
|
||||
@@ -103,7 +102,7 @@ void Connection::shutdown()
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
|
||||
DEBUG_LOG() << "shutting down connection for " << m_partition
|
||||
DEBUG_LOG(m_logger) << "shutting down connection for " << m_partition
|
||||
<< ", direction: " << m_description
|
||||
<< " (" << this << "), dwt: " << m_dataWriterTask.get();
|
||||
|
||||
@@ -152,7 +151,7 @@ dds::sub::Subscriber Connection::subscriber() const
|
||||
|
||||
bool Connection::initTopics()
|
||||
{
|
||||
DEBUG_LOG() << "Init topics for " << m_partition
|
||||
DEBUG_LOG(m_logger) << "Init topics for " << m_partition
|
||||
<< ", direction: " << m_description;
|
||||
|
||||
if (!m_output)
|
||||
|
||||
@@ -38,9 +38,11 @@ public:
|
||||
dds::sub::Subscriber subscriber() const;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool initTopics();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
Connection *m_output;
|
||||
dds::domain::DomainParticipant m_domainParticipant;
|
||||
std::unique_ptr<DDSConnector::Publisher> m_publisher;
|
||||
|
||||
@@ -13,13 +13,13 @@ namespace RoutingService
|
||||
DataWriterTask::DataWriterTask()
|
||||
: m_doShutdown(false)
|
||||
{
|
||||
DEBUG_LOG() << this << ": init ";
|
||||
DEBUG_LOG(m_logger) << this << ": init ";
|
||||
}
|
||||
|
||||
DataWriterTask::~DataWriterTask()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_queueLock);
|
||||
DEBUG_LOG() << this << ": Cleaning up remaining writers: " << m_writerQueue.size();
|
||||
DEBUG_LOG(m_logger) << this << ": Cleaning up remaining writers: " << m_writerQueue.size();
|
||||
while (!m_writerQueue.empty())
|
||||
{
|
||||
delete m_writerQueue.front();
|
||||
@@ -30,7 +30,7 @@ DataWriterTask::~DataWriterTask()
|
||||
void DataWriterTask::enqueue(SampleWriterInterface *swi)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_queueLock);
|
||||
TRACE_LOG() << this << ": enqueue " << swi << " shutdown: " << m_doShutdown;
|
||||
TRACE_LOG(m_logger) << this << ": enqueue " << swi << " shutdown: " << m_doShutdown;
|
||||
if (m_doShutdown)
|
||||
{
|
||||
delete swi;
|
||||
@@ -44,7 +44,7 @@ void DataWriterTask::shutdown()
|
||||
{
|
||||
std::lock_guard<std::mutex> l(m_queueLock);
|
||||
m_doShutdown = true;
|
||||
DEBUG_LOG() << this << ": Cleaning up remaining writers: " << m_writerQueue.size();
|
||||
DEBUG_LOG(m_logger) << this << ": Cleaning up remaining writers: " << m_writerQueue.size();
|
||||
while (!m_writerQueue.empty())
|
||||
{
|
||||
delete m_writerQueue.front();
|
||||
@@ -56,7 +56,7 @@ void DataWriterTask::shutdown()
|
||||
|
||||
bool DataWriterTask::waitForData()
|
||||
{
|
||||
TRACE_LOG() << this << ": waiting for data ";
|
||||
TRACE_LOG(m_logger) << this << ": waiting for data ";
|
||||
std::unique_lock<std::mutex> waitCondLock(m_queueLock);
|
||||
while (true)
|
||||
{
|
||||
@@ -78,7 +78,7 @@ SampleWriterInterface *DataWriterTask::getNextSampleWriter()
|
||||
if (m_writerQueue.empty())
|
||||
return nullptr;
|
||||
|
||||
TRACE_LOG() << this << ": getData() queue size: " << m_writerQueue.size();
|
||||
TRACE_LOG(m_logger) << this << ": getData() queue size: " << m_writerQueue.size();
|
||||
auto ret = m_writerQueue.front();
|
||||
m_writerQueue.pop();
|
||||
return ret;
|
||||
|
||||
@@ -31,6 +31,7 @@ public:
|
||||
void writeSamples();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::queue<SampleWriterInterface *> m_writerQueue;
|
||||
std::mutex m_queueLock;
|
||||
std::condition_variable m_waitForDataCondition;
|
||||
|
||||
@@ -39,7 +39,7 @@ bool MainHandler::init(int domainIdIn, int domainIdOut, unsigned short tcpPortOu
|
||||
|
||||
if (!DDS::QosProfile::setDefault())
|
||||
{
|
||||
ERROR_LOG() << "Error setting default QoS from xml-file ";
|
||||
ERROR_LOG(m_logger) << "Error setting default QoS from xml-file ";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::unique_ptr<SessionHandler> m_sessionHandler;
|
||||
std::unique_ptr<PartitionHandler> m_partitionHandler;
|
||||
std::shared_ptr<Core::Pacemaker> m_pacemaker;
|
||||
|
||||
@@ -11,11 +11,10 @@
|
||||
|
||||
namespace RoutingService
|
||||
{
|
||||
PartitionHandler::PartitionHandler(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector, QObject *parent)
|
||||
: QObject(parent)
|
||||
PartitionHandler::PartitionHandler(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector, QObject *parent) : QObject(parent)
|
||||
, m_exmDtc(ExerciseManagement::Interface::Dtc::create(ddsConnector))
|
||||
, m_destroyTimer(new QTimer(this))
|
||||
{
|
||||
, m_destroyTimer(new QTimer(this)),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
m_exmDtc->enableExercise();
|
||||
|
||||
m_destroyTimer->setInterval(1000);
|
||||
@@ -68,7 +67,7 @@ void PartitionHandler::partitionRemoved(const QString &partitionName)
|
||||
void PartitionHandler::onExerciseChanged(const ExerciseManagement::Exercise &data, DataModification modType)
|
||||
{
|
||||
const QString partitionName(QString::fromStdString(DDSConnector::DdsConnector::getPartitionString(IDL::PartitionType::Exercise, data.id())));
|
||||
DEBUG_LOG() << "onExerciseChanged: " << data << ", modType: " << modType;
|
||||
DEBUG_LOG(m_logger) << "onExerciseChanged: " << data << ", modType: " << modType;
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eRemoved:
|
||||
@@ -92,7 +91,7 @@ void PartitionHandler::onDestroyTimerTimeout()
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
DEBUG_LOG() << "onDestroyTimerTimeout for session " << it.key() << " triggered";
|
||||
DEBUG_LOG(m_logger) << "onDestroyTimerTimeout for session " << it.key() << " triggered";
|
||||
delete et;
|
||||
m_activeSessions.remove(it.key());
|
||||
emit destroySession(it.key(), it.key());
|
||||
|
||||
@@ -28,6 +28,7 @@ public:
|
||||
bool init();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void partitionModified(const QString &partitionName, const ExerciseManagement::ExerciseState &state);
|
||||
void partitionRemoved(const QString &partitionName);
|
||||
private Q_SLOTS:
|
||||
@@ -38,6 +39,7 @@ Q_SIGNALS:
|
||||
void destroySession(const QString &partitionNameSv, const QString &partitionNameWs);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
|
||||
QMap<QString, QElapsedTimer *> m_destroyMap;
|
||||
QSet<QString> m_activeSessions;
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
|
||||
namespace RoutingService
|
||||
{
|
||||
Session::Session(const QString &partitionNameSv, const QString &partitionNameWs)
|
||||
: m_partitionNameSv(partitionNameSv.toStdString())
|
||||
, m_partitionNameWs(partitionNameWs.toStdString())
|
||||
{}
|
||||
Session::Session(const QString &partitionNameSv, const QString &partitionNameWs) : m_partitionNameSv(partitionNameSv.toStdString())
|
||||
, m_partitionNameWs(partitionNameWs.toStdString()),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
Session::~Session()
|
||||
{
|
||||
@@ -26,7 +25,7 @@ bool Session::init(const dds::domain::DomainParticipant &dpIn,
|
||||
const std::vector<TopicDispatcherInterface *> &topicsToRouteToWs,
|
||||
const std::vector<TopicDispatcherInterface *> &topicsToRouteToSv)
|
||||
{
|
||||
DEBUG_LOG() << "Creating new session for " << m_partitionNameSv << "-" << m_partitionNameWs;
|
||||
DEBUG_LOG(m_logger) << "Creating new session for " << m_partitionNameSv << "-" << m_partitionNameWs;
|
||||
|
||||
m_connectionSvToWs.reset(new Connection(dpIn, m_partitionNameSv, topicsToRouteToWs, "route to WS"));
|
||||
m_connectionWsToSv.reset(new Connection(dpOut, m_partitionNameWs, topicsToRouteToSv, "route from WS"));
|
||||
@@ -40,7 +39,7 @@ bool Session::init(const dds::domain::DomainParticipant &dpIn,
|
||||
|
||||
void Session::shutdown()
|
||||
{
|
||||
DEBUG_LOG() << "Shutting down session for " << m_partitionNameSv << "-" << m_partitionNameWs;
|
||||
DEBUG_LOG(m_logger) << "Shutting down session for " << m_partitionNameSv << "-" << m_partitionNameWs;
|
||||
if (m_connectionSvToWs)
|
||||
{
|
||||
m_connectionSvToWs->shutdown();
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
void shutdown();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::string m_partitionNameSv;
|
||||
std::string m_partitionNameWs;
|
||||
std::unique_ptr<Connection> m_connectionSvToWs;
|
||||
|
||||
@@ -49,7 +49,7 @@ void SessionHandler::onCreateSession(const QString &partitionNameSv, const QStri
|
||||
const QString partitionName = partitionNameSv + QLatin1Char('-') + partitionNameWs;
|
||||
if (m_sessionMap.contains(partitionName))
|
||||
{
|
||||
WARNING_LOG() << "Got create session for " << partitionName << ", but is already created";
|
||||
WARNING_LOG(m_logger) << "Got create session for " << partitionName << ", but is already created";
|
||||
return;
|
||||
}
|
||||
Session *session = new Session(partitionNameSv, partitionNameWs);
|
||||
@@ -58,12 +58,12 @@ void SessionHandler::onCreateSession(const QString &partitionNameSv, const QStri
|
||||
topicsToRouteToWs(),
|
||||
topicsToRouteToSv()))
|
||||
{
|
||||
WARNING_LOG() << "Can not initialize session for " << partitionName << ", routing will not work...!";
|
||||
WARNING_LOG(m_logger) << "Can not initialize session for " << partitionName << ", routing will not work...!";
|
||||
delete session;
|
||||
return;
|
||||
}
|
||||
m_sessionMap[partitionName] = session;
|
||||
INFO_LOG() << "Successfully created session for " << partitionName;
|
||||
INFO_LOG(m_logger) << "Successfully created session for " << partitionName;
|
||||
}
|
||||
|
||||
void SessionHandler::onDestroySession(const QString &partitionNameSv, const QString &partitionNameWs)
|
||||
@@ -72,14 +72,14 @@ void SessionHandler::onDestroySession(const QString &partitionNameSv, const QStr
|
||||
auto it = m_sessionMap.find(partitionName);
|
||||
if (it == m_sessionMap.end())
|
||||
{
|
||||
WARNING_LOG() << "Got destroy session for " << partitionName << ", but is not created (already destroyed?)";
|
||||
WARNING_LOG(m_logger) << "Got destroy session for " << partitionName << ", but is not created (already destroyed?)";
|
||||
return;
|
||||
}
|
||||
Session *session = it.value();
|
||||
session->shutdown();
|
||||
delete session;
|
||||
m_sessionMap.erase(it);
|
||||
INFO_LOG() << "Successfully destroyed session for " << partitionName;
|
||||
INFO_LOG(m_logger) << "Successfully destroyed session for " << partitionName;
|
||||
}
|
||||
|
||||
bool SessionHandler::loadPlugins()
|
||||
@@ -107,7 +107,7 @@ bool SessionHandler::loadPlugin(const LtsPluginManager::PluginInstance &pi)
|
||||
QStringLiteral("PDM"),
|
||||
});
|
||||
if (skipList.contains(pi.pluginName.toUpper()))
|
||||
DEBUG_LOG() << "Skipping plugin " << pi.pluginName.toUpper() << " - is global";
|
||||
DEBUG_LOG(m_logger) << "Skipping plugin " << pi.pluginName.toUpper() << " - is global";
|
||||
|
||||
m_topicTypePlugins.push_back(typePlugin);
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ public Q_SLOTS:
|
||||
void onCreateSession(const QString &partitionNameSv, const QString &partitionNameWs);
|
||||
void onDestroySession(const QString &partitionNameSv, const QString &partitionNameWs);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool loadPlugins();
|
||||
bool loadPlugin(const LtsPluginManager::PluginInstance &pi);
|
||||
|
||||
@@ -51,6 +52,7 @@ private:
|
||||
std::vector<TopicDispatcherInterface *> topicsToRouteToSv() const;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::vector<DDSGeneric::TopicTypePlugin *> m_topicTypePlugins;
|
||||
|
||||
IDL::PartitionType m_partitionType;
|
||||
|
||||
Reference in new issue
Block a user