public ResultWrapper Execute(string name, ParameterWrapper[] parameters) { ActionWrapper action = this.GetAction(name); string path = RestWrapper.BuildActionUrl(parameters, action); int num = 0; int interval = action.Interval; while (num <= action.NumberOfRetries) { ++num; try { ResultWrapper result = CircuitBreakerContainer.GetCircuitBreaker(this.interfaceType).Execute(this.baseUri + path, (Func <ResultWrapper>)(() => this.InvokeAction(name, parameters, action, path)), this._serviceLocator); if (result.Error != null) { if (result.Error is SuspendedDependencyException || !action.Retry || num > action.NumberOfRetries || !this.IsTransient(action, result.Error)) { return(result); } this._serviceLocator.GetService <ILogger>()?.Error(result.Error); this._serviceLocator.GetService <ILogger>()?.Message(string.Format("Retrying action {0}, retry count {1}", (object)action.Name, (object)num)); interval *= action.IncrementalRetry ? num : 1; result.EndState(); Thread.Sleep(interval); } else { if (num > 1) { result.GetState().Extras.Add("retryCount", (object)num); } return(result); } } catch (Exception ex) { this._logger?.Error(ex); if (!action.Retry || num > action.NumberOfRetries || !this.IsTransient(action, ex)) { throw; } else { Thread.Sleep(action.IncrementalRetry ? num : action.Interval); } } } throw new Exception("Should not get here!?!"); }