private static T InvokeOnce <T>(ref int retryCount, int maxRetryCount, TimeSpan slowResponseTime, TimeSpan sleepInterval, Func <T> action, Predicate <Exception> isRetriableException, Predicate <Exception> isDataStoreUnavailableException, Action <Exception, int> onRetry, Action <Exception, int> onMaxRetry, Action <TimeSpan> onSlowResponse, out bool needsRetry) { T result = default(T); needsRetry = false; RetryHelper.InvokeOnce(ref retryCount, maxRetryCount, slowResponseTime, sleepInterval, delegate() { result = action(); }, isRetriableException, isDataStoreUnavailableException, onRetry, onMaxRetry, onSlowResponse, out needsRetry); return(result); }
public static void Invoke(TimeSpan slowResponseTime, TimeSpan sleepInterval, int maxRetryCount, Action retryableAction, Predicate <Exception> isRetriableException, Action <Exception, int> onRetry, Action <Exception, int> onMaxRetry, Action <TimeSpan> onSlowResponse, Action <Exception> onUnhandledException, Predicate <Exception> isDataStoreUnavailableException) { int num = 0; try { bool flag; do { flag = false; RetryHelper.InvokeOnce(ref num, maxRetryCount, slowResponseTime, sleepInterval, retryableAction, isRetriableException, isDataStoreUnavailableException, onRetry, onMaxRetry, onSlowResponse, out flag); }while (flag); } catch (Exception obj) { onUnhandledException(obj); throw; } }
public static T Invoke <T>(TimeSpan slowResponseTime, TimeSpan sleepInterval, int maxRetryCount, Func <T> action, Predicate <Exception> isRetriableException, Action <Exception, int> onRetry, Action <Exception, int> onMaxRetry, Action <TimeSpan> onSlowResponse, Action <Exception> onUnhandledException, Predicate <Exception> isDataStoreUnavailableException) { int num = 0; T result = default(T); try { bool flag; do { flag = false; result = RetryHelper.InvokeOnce <T>(ref num, maxRetryCount, slowResponseTime, sleepInterval, action, isRetriableException, isDataStoreUnavailableException, onRetry, onMaxRetry, onSlowResponse, out flag); }while (flag); } catch (Exception obj) { onUnhandledException(obj); throw; } return(result); }