/// <summary>
 /// 执行
 /// </summary>
 /// <param name="cancellationToken">取消令牌</param>
 public void Execute(CancellationToken cancellationToken)
 {
     cancellationToken.WaitHandle.WaitOne();
     if (cancellationToken.IsCancellationRequested)
     {
         _subscribeObject.Unsubscribe();
         _mre.Dispose();
         _subscribeObject.Dispose();
     }
 }
        void IServerComponent.Execute(CancellationToken cancellationToken)
        {
            cancellationToken.WaitHandle.WaitOne();

            if (cancellationToken.IsCancellationRequested)
            {
                //_subscriber.Unsubscribe(Channel);
                subscribeObject.Unsubscribe();
                _mre.Dispose();
                subscribeObject.Dispose();
            }
        }
Beispiel #3
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    _subscribeObject?.Dispose();
                }

                disposedValue = true;
            }
        }
Beispiel #4
0
 /// <summary>
 /// 同步关闭状态
 /// </summary>
 /// <returns></returns>
 Task ILifeFlow.Close()
 {
     try
     {
         subscribeObject?.Dispose();
         client?.Dispose();
     }
     catch (Exception ex)
     {
         Logger.Exception(ex);
     }
     return(Task.CompletedTask);
 }