virtual public void Stop()
{
lock (this)
{
if (Interlocked.Read(ref m_Run) == 0)
{
return;
}
if (Interlocked.Exchange(ref m_PendingRun, 0) == 0)
{
return;
}
SendLog("正在关闭" + Name + "告警适配器...");
_PreStopStage();
AdapterStateReport(AdapterStatus.Stop, null);
if (!AdapterLogout())
{
SendLog("从告警服务器注销失败, 服务器中信息可能不正确.");
}
try
{
if (m_CommClient != null)
{
m_CommClient.onConnectionBroken -= new ClientConnectionBrokenHandler(DBAdapterBase_onConnectionBroken);
m_CommClient.Close();
}
}
catch { }
m_TimerMaintenance.Stop();
_PostStopStage();
try
{
m_StopPrivilege.AcquireWriterLock(-1);
}
finally
{
m_StopPrivilege.ReleaseLock();
}
Interlocked.Exchange(ref m_Run, 0);
SendLog(Name + "告警适配器已结束.");
}
}