MXS-1775 Thread starting is now handled by MonitorInstance
This commit is contained in:
@ -79,8 +79,6 @@ NDBCMonitor::NDBCMonitor(MXS_MONITOR *monitor)
|
||||
|
||||
NDBCMonitor::~NDBCMonitor()
|
||||
{
|
||||
ss_dassert(!m_thread);
|
||||
ss_dassert(!m_script);
|
||||
}
|
||||
|
||||
// static
|
||||
@ -94,52 +92,6 @@ void NDBCMonitor::destroy()
|
||||
delete this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the instance of the monitor, returning a handle on the monitor.
|
||||
*
|
||||
* This function creates a thread to execute the actual monitoring.
|
||||
*
|
||||
* @return A handle to use when interacting with the monitor
|
||||
*/
|
||||
bool NDBCMonitor::start(const MXS_CONFIG_PARAMETER *params)
|
||||
{
|
||||
bool started = false;
|
||||
|
||||
ss_dassert(!m_shutdown);
|
||||
ss_dassert(!m_thread);
|
||||
ss_dassert(!m_script);
|
||||
|
||||
if (!m_checked)
|
||||
{
|
||||
if (!has_sufficient_permissions())
|
||||
{
|
||||
MXS_ERROR("Failed to start monitor. See earlier errors for more information.");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_checked)
|
||||
{
|
||||
configure(params);
|
||||
|
||||
if (thread_start(&m_thread, &maxscale::MonitorInstance::main, this, 0) == NULL)
|
||||
{
|
||||
MXS_ERROR("Failed to start monitor thread for monitor '%s'.", m_monitor->name);
|
||||
MXS_FREE(m_script);
|
||||
m_script = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
started = true;
|
||||
}
|
||||
}
|
||||
|
||||
return started;
|
||||
}
|
||||
|
||||
bool NDBCMonitor::has_sufficient_permissions() const
|
||||
{
|
||||
return check_monitor_permissions(m_monitor, "SHOW STATUS LIKE 'Ndb_number_of_ready_data_nodes'");
|
||||
@ -147,8 +99,6 @@ bool NDBCMonitor::has_sufficient_permissions() const
|
||||
|
||||
void NDBCMonitor::configure(const MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
m_script = config_copy_string(params, "script");
|
||||
m_events = config_get_enum(params, "events", mxs_monitor_event_enum_values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user