Exemple #1
0
 public void Shutdown(IQueueThrottling queueThrottling)
 {
     Debug.WriteLine("BufferingManager.Shutdown()");
     if (null == queueThrottling)
     {
         throw new ArgumentNullException("queueThrottling");
     }
     this.ThrowIfDisposed();
     if (!object.ReferenceEquals((object)Interlocked.CompareExchange <IQueueThrottling>(ref this._queueThrottling, (IQueueThrottling)null, queueThrottling), (object)queueThrottling))
     {
         throw new InvalidOperationException("Shutting down the wrong queueThrottling instance");
     }
     this.RefreshHandler();
 }
Exemple #2
0
        private void HandleStateChange()
        {
            IQueueThrottling queueThrottling = Volatile.Read <IQueueThrottling>(ref this._queueThrottling);

            if (null == queueThrottling)
            {
                return;
            }
            if (this._blockReads)
            {
                queueThrottling.Pause();
            }
            else
            {
                queueThrottling.Resume();
            }
        }
Exemple #3
0
 public void Initialize(IQueueThrottling queueThrottling, Action reportBufferingChange)
 {
     Debug.WriteLine("BufferingManager.Initialize()");
     if (null == queueThrottling)
     {
         throw new ArgumentNullException("queueThrottling");
     }
     if (reportBufferingChange == null)
     {
         throw new ArgumentNullException("reportBufferingChange");
     }
     this.ThrowIfDisposed();
     if (null != Interlocked.CompareExchange <IQueueThrottling>(ref this._queueThrottling, queueThrottling, (IQueueThrottling)null))
     {
         throw new InvalidOperationException("The buffering manager is in use");
     }
     this.HandleStateChange();
     this._reportingTask = new SignalTask((Func <Task>)(() =>
     {
         reportBufferingChange();
         return(TplTaskExtensions.CompletedTask);
     }), this._disposeCancellationTokenSource.Token);
 }
Exemple #4
0
        public void Initialize(IQueueThrottling queueThrottling, Action reportBufferingChange)
        {
            Debug.WriteLine("BufferingManager.Initialize()");

            if (null == queueThrottling)
                throw new ArgumentNullException(nameof(queueThrottling));
            if (reportBufferingChange == null)
                throw new ArgumentNullException(nameof(reportBufferingChange));

            ThrowIfDisposed();

            if (null != Interlocked.CompareExchange(ref _queueThrottling, queueThrottling, null))
                throw new InvalidOperationException("The buffering manager is in use");

            HandleStateChange();

            _reportingTask = new SignalTask(() =>
            {
                reportBufferingChange();

                return TplTaskExtensions.CompletedTask;
            }, _disposeCancellationTokenSource.Token);
        }
 public void Shutdown(IQueueThrottling queueThrottling)
 {
 }
 public void Initialize(IQueueThrottling queueThrottling, Action reportBufferingChange)
 {
 }
 public void Shutdown(IQueueThrottling queueThrottling)
 { }
 public void Initialize(IQueueThrottling queueThrottling, Action reportBufferingChange)
 { }
Exemple #9
0
        public void Shutdown(IQueueThrottling queueThrottling)
        {
            Debug.WriteLine("BufferingManager.Shutdown()");

            if (null == queueThrottling)
                throw new ArgumentNullException(nameof(queueThrottling));

            ThrowIfDisposed();

            var currrentQueueThrottling = Interlocked.CompareExchange(ref _queueThrottling, null, queueThrottling);
            if (!ReferenceEquals(currrentQueueThrottling, queueThrottling))
                throw new InvalidOperationException("Shutting down the wrong queueThrottling instance");

            RefreshHandler();
        }