Exemplo n.º 1
0
        protected override void InvokeAsyncCallback(IAsyncExecutionContext executionContext)
        {
            IAsyncRequestContext  requestContext    = executionContext.RequestContext;
            IAsyncResponseContext responseContext   = executionContext.ResponseContext;
            Exception             exception         = responseContext.AsyncResult.Exception;
            IExecutionContext     executionContext2 = ExecutionContext.CreateFromAsyncContext(executionContext);

            if (exception != null)
            {
                if (RetryPolicy.Retry(executionContext2, exception))
                {
                    requestContext.Retries++;
                    requestContext.Metrics.SetCounter(Metric.AttemptCount, requestContext.Retries);
                    LogForRetry(requestContext, exception);
                    PrepareForRetry(requestContext);
                    responseContext.AsyncResult.Exception = null;
                    using (requestContext.Metrics.StartEvent(Metric.RetryPauseTime))
                    {
                        RetryPolicy.WaitBeforeRetry(executionContext2);
                    }
                    InvokeAsync(executionContext);
                    return;
                }
                LogForError(requestContext, exception);
            }
            else
            {
                RetryPolicy.NotifySuccess(executionContext2);
            }
            base.InvokeAsyncCallback(executionContext);
        }
Exemplo n.º 2
0
        protected override void InvokeAsyncCallback(IAsyncExecutionContext executionContext)
        {
            IAsyncRequestContext  requestContext  = executionContext.RequestContext;
            IAsyncResponseContext responseContext = executionContext.ResponseContext;
            Exception             exception       = responseContext.AsyncResult.Exception;

            if (exception != null)
            {
                try
                {
                    DisposeReponse(executionContext.ResponseContext);
                    if (!ProcessException(ExecutionContext.CreateFromAsyncContext(executionContext), exception))
                    {
                        responseContext.AsyncResult.Exception = null;
                    }
                }
                catch (Exception exception2)
                {
                    responseContext.AsyncResult.Exception = exception2;
                }
            }
            base.InvokeAsyncCallback(executionContext);
        }
Exemplo n.º 3
0
 public AsyncExecutionContext(IAsyncRequestContext requestContext, IAsyncResponseContext responseContext)
 {
     this.RequestContext  = requestContext;
     this.ResponseContext = responseContext;
 }
Exemplo n.º 4
0
 public AsyncExecutionContext(IAsyncRequestContext requestContext, IAsyncResponseContext responseContext)
 {
     this.RequestContext = requestContext;
     this.ResponseContext = responseContext;
 }