示例#1
0
 internal void AddRetryTask(ProxyOutgoingAsyncBase outAsync, int interval)
 {
     lock (this)
     {
         if (_state == StateDestroyed)
         {
             throw new CommunicatorDestroyedException();
         }
         RetryTask task = new RetryTask(this, outAsync);
         outAsync.Cancelable(task); // This will throw if the request is canceled.
         _timer.Schedule(task, interval);
         _requests.Add(task, null);
     }
 }
示例#2
0
 internal void RemoveRetryTask(RetryTask task)
 {
     lock (this)
     {
         if (_requests.Remove(task))
         {
             if (_state == StateDestroyed && _requests.Count == 0)
             {
                 // If we are destroying the queue, destroy is probably waiting on the queue to be empty.
                 System.Threading.Monitor.Pulse(this);
             }
         }
     }
 }
示例#3
0
 internal bool CancelRetryTask(RetryTask task)
 {
     lock (this)
     {
         if (_requests.Remove(task))
         {
             if (_state == StateDestroyed && _requests.Count == 0)
             {
                 // If we are destroying the queue, destroy is probably waiting on the queue to be empty.
                 System.Threading.Monitor.Pulse(this);
             }
             return(_timer.Cancel(task));
         }
         return(false);
     }
 }