protected override void BeginRequest(RetryQueueRequest request)
 {
     //Adding an intentional delay here to work around a known timing issue
     //with the SSME.  If this is called too soon after initialization the
     //request will be aborted with no indication raised from the SSME.
     //TODO: Remove this workaround once the SSME has been fixed.
     DispatcherTimer timer = new DispatcherTimer();
     timer.Interval = TimeSpan.FromMilliseconds(250);
     EventHandler tickHandler = null;
     tickHandler = (s, e) =>
         {
             SegmentInfo segment = null;
             List<StreamInfo> streams = null;
             var streamSelectionRequest = request as StreamSelectionRequest;
             if (streamSelectionRequest != null)
             {
                 streams = streamSelectionRequest.Streams.ToList();
                 segment = streamSelectionRequest.Segment;
             }
             else
             {
                 var streamModifyRequest = request as StreamModifyRequest;
                 if (streamModifyRequest != null)
                 {
                     streams = streamModifyRequest.Streams.ToList();
                     segment = streamModifyRequest.Segment;
                 }
             }                    
             segment.SelectStreamsAsync(streams, request);
             timer.Tick -= tickHandler;
             timer.Stop();
         };
     timer.Tick += tickHandler;
     timer.Start();
 }
Esempio n. 2
0
        private void AttemptToStartRequests()
        {
            lock (_threadSync)
            {
                while (HasPendingRequests && _activeRequests.Count < MaximumConcurrentRequests)
                {
                    RetryQueueRequest nextItem = NextRequest();
                    if (nextItem != null)
                    {
                        nextItem.LastAttemptStarted = DateTime.Now;
                        _activeRequests.Add(nextItem);

                        BeginRequest(nextItem);

                        if (!_timeoutMonitor.IsEnabled)
                        {
                            _timeoutMonitor.Start();
                        }
                    }
                    else
                    {
                        if (!_timeoutMonitor.IsEnabled)
                        {
                            _timeoutMonitor.Start();
                        }
                        break;
                    }
                }
            }
        }
Esempio n. 3
0
        protected override void OnRequestExceededMaximumRetryAttempts(RetryQueueRequest request)
        {
            base.OnRequestExceededMaximumRetryAttempts(request);

            var streamSelectionRequest = request as IStreamSelectionRequest;

            if (StreamSelectionExceededMaximumRetries != null && streamSelectionRequest != null)
            {
                StreamSelectionExceededMaximumRetries(this, streamSelectionRequest.Segment, streamSelectionRequest.Streams);
            }
        }
Esempio n. 4
0
        protected override void OnRetryingRequest(RetryQueueRequest request)
        {
            base.OnRetryingRequest(request);

            var streamSelectionRequest = request as IStreamSelectionRequest;

            if (RetryingStreamSelection != null && streamSelectionRequest != null)
            {
                RetryingStreamSelection(this, streamSelectionRequest.Segment, streamSelectionRequest.Streams);
            }
        }
Esempio n. 5
0
        protected void NotifyRequestSuccessful(RetryQueueRequest request)
        {
            lock (_threadSync)
            {
                if (_activeRequests.Contains(request))
                {
                    _activeRequests.Remove(request);
                }
            }

            OnRequestCompleted(request);
            AttemptToStartRequests();
        }
        protected void NotifyRequestSuccessful(RetryQueueRequest request)
        {
            lock (_threadSync)
            {
                if (_activeRequests.Contains(request))
                {
                    _activeRequests.Remove(request);
                }
            }

            OnRequestCompleted(request);
            AttemptToStartRequests();
        }
Esempio n. 7
0
        protected override void BeginRequest(RetryQueueRequest request)
        {
            //Adding an intentional delay here to work around a known timing issue
            //with the SSME.  If this is called too soon after initialization the
            //request will be aborted with no indication raised from the SSME.
            //TODO: Remove this workaround once the SSME has been fixed.
            DispatcherTimer timer = new DispatcherTimer();

            timer.Interval = TimeSpan.FromMilliseconds(250);
            EventHandler tickHandler = null;

            tickHandler = (s, e) =>
            {
                SegmentInfo       segment  = null;
                List <StreamInfo> streams  = null;
                var streamSelectionRequest = request as StreamSelectionRequest;
                if (streamSelectionRequest != null)
                {
                    streams = streamSelectionRequest.Streams.ToList();
                    segment = streamSelectionRequest.Segment;
                }
                else
                {
                    var streamModifyRequest = request as StreamModifyRequest;
                    if (streamModifyRequest != null)
                    {
                        streams = streamModifyRequest.Streams.ToList();
                        segment = streamModifyRequest.Segment;
                    }
                }
                segment.SelectStreamsAsync(streams, request);
                timer.Tick -= tickHandler;
                timer.Stop();
            };
            timer.Tick += tickHandler;
            timer.Start();
        }
Esempio n. 8
0
 protected void AddRequest(RetryQueueRequest request)
 {
     _requestQueue.Enqueue(request);
     NotifyRequestAdded();
 }
 protected void AddRequest(RetryQueueRequest request)
 {
     _requestQueue.Enqueue(request);
     NotifyRequestAdded();
 }
 protected virtual void CancelRequest(RetryQueueRequest request) { }
 protected virtual void OnRequestCompleted(RetryQueueRequest request) { }
Esempio n. 12
0
 protected virtual void OnRequestCompleted(RetryQueueRequest request)
 {
 }
 protected virtual void OnRetryingRequest(RetryQueueRequest request) { }
Esempio n. 14
0
 protected abstract void BeginRequest(RetryQueueRequest request);
        protected override void OnRequestExceededMaximumRetryAttempts(RetryQueueRequest request)
        {
            base.OnRequestExceededMaximumRetryAttempts(request);

            var streamSelectionRequest = request as IStreamSelectionRequest;
            if (StreamSelectionExceededMaximumRetries != null && streamSelectionRequest != null)
            {
                StreamSelectionExceededMaximumRetries(this, streamSelectionRequest.Segment, streamSelectionRequest.Streams);
            }
        }
Esempio n. 16
0
 protected virtual void OnRetryingRequest(RetryQueueRequest request)
 {
 }
        protected override void OnRetryingRequest(RetryQueueRequest request)
        {
            base.OnRetryingRequest(request);

            var streamSelectionRequest = request as IStreamSelectionRequest;
            if (RetryingStreamSelection != null && streamSelectionRequest != null)
            {
                RetryingStreamSelection(this, streamSelectionRequest.Segment, streamSelectionRequest.Streams);
            }
        }
Esempio n. 18
0
 protected virtual void CancelRequest(RetryQueueRequest request)
 {
 }
 protected virtual void OnRequestExceededMaximumRetryAttempts(RetryQueueRequest request) { }
 protected abstract void BeginRequest(RetryQueueRequest request);
Esempio n. 21
0
 protected virtual void OnRequestExceededMaximumRetryAttempts(RetryQueueRequest request)
 {
 }