MXS-1775 Introduce MonitorInstance::configure() function

The configuring of the monitor instance is now performed in a
separate function. That is in preparation for the moving of the
start function to maxscale::MonitorInstance.
This commit is contained in:
Johan Wikman
2018-05-16 11:35:24 +03:00
parent bcb7d09a15
commit 3606a5ed1c
12 changed files with 93 additions and 25 deletions

View File

@ -51,20 +51,38 @@ bool GRMon::start(const MXS_CONFIG_PARAMETER* params)
{
bool started = false;
m_shutdown = 0;
m_master = NULL;
m_script = config_get_string(params, "script");
m_events = config_get_enum(params, "events", mxs_monitor_event_enum_values);
m_thread = 0;
ss_dassert(!m_shutdown);
ss_dassert(!m_thread);
if (thread_start(&m_thread, &maxscale::MonitorInstance::main, this, 0) != NULL)
if (!m_checked)
{
started = true;
m_checked = true;
}
if (m_checked)
{
configure(params);
if (thread_start(&m_thread, &maxscale::MonitorInstance::main, this, 0) == NULL)
{
;
}
else
{
started = true;
}
}
return started;
}
void GRMon::configure(const MXS_CONFIG_PARAMETER* params)
{
m_script = config_get_string(params, "script");
m_events = config_get_enum(params, "events", mxs_monitor_event_enum_values);
m_master = NULL;
}
void GRMon::diagnostics(DCB* dcb) const
{
}