Cgw.Channel.MonitorChannelManager.RemoveChannel C# (CSharp) Method

RemoveChannel() public method

移除通道
public RemoveChannel ( string channelLabel ) : void
channelLabel string
return void
        public void RemoveChannel(string channelLabel)
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);

            try
            {
                bool successed = this.channelDicLocker.TryEnterWriteLock(CgwConst.ENTER_LOCK_WAIT_TIME);
                // 申请互斥
                if (successed)
                {
                    try
                    {
                        if (this.monitorChannelDic.ContainsKey(channelLabel))
                        {
                            this.monitorChannelDic[channelLabel].StopThread();
                            this.monitorChannelDic.Remove(channelLabel);
                        }

                        logEx.Trace("Remove Channel channelLabel:{0}", channelLabel);
                    }
                    finally
                    {
                        // 释放互斥量
                        this.channelDicLocker.ExitWriteLock();
                    }
                }
                else
                {
                    // 日志
                    logEx.Error("RemoveChannel: Enert Write Lock Failed.WaitingReadCount:{0};WaitingWriteCount:{1}.", this.channelDicLocker.WaitingReadCount, this.channelDicLocker.WaitingWriteCount);
                }
            }
            catch (Exception ex)
            {
                // 日志
                logEx.Error(ex, "RemoveChannel: Enert Write Lock Exception.");
            }
        }