public RetryableCommandExecutor(RetryableCommand retryableCommand, TimeSpan maxWaitTime) { Platform.CheckForNullReference(retryableCommand, "retryableCommand"); Platform.CheckNonNegative((int)maxWaitTime.TotalMilliseconds, "maxWaitTime"); _maxWaitTime = maxWaitTime; _retryableCommand = retryableCommand; _needMoreMemory = true; }
public RetryableCommandExecutor(RetryableCommand retryableCommand, TimeSpan maxWaitTime) { Platform.CheckForNullReference(retryableCommand, "retryableCommand"); Platform.CheckNonNegative((int)maxWaitTime.TotalMilliseconds, "maxWaitTime"); _maxWaitTime = maxWaitTime; _retryableCommand = retryableCommand; _needMoreMemory = true; }
/// <summary> /// Executes the given <see cref="RetryableCommand"/> inside the memory manager. /// </summary> /// <remarks> /// The <see cref="RetryableCommand"/> will be executed at least once, but may be called /// repeatedly in the case where it throws an <see cref="OutOfMemoryException"/>. When the /// <see cref="RetryableCommand"/> does throw an <see cref="OutOfMemoryException"/>, a memory /// collection will be triggered and the memory manager will continue to call the <see cref="RetryableCommand"/> /// until the call succeeds or <paramref name="maxWaitTimeMilliseconds"/> has elapsed. If the timeout /// has elapsed and the call fails, the <see cref="OutOfMemoryException"/> is rethrown. /// </remarks> public static void Execute(RetryableCommand retryableCommand, int maxWaitTimeMilliseconds) { Execute(retryableCommand, TimeSpan.FromMilliseconds(maxWaitTimeMilliseconds)); }
/// <summary> /// Executes the given <see cref="RetryableCommand"/> inside the memory manager. /// </summary> /// <remarks> /// The <see cref="RetryableCommand"/> will be executed at least once, but may be called /// repeatedly in the case where it throws an <see cref="OutOfMemoryException"/>. When the /// <see cref="RetryableCommand"/> does throw an <see cref="OutOfMemoryException"/>, a memory /// collection will be triggered and the memory manager will continue to call the <see cref="RetryableCommand"/> /// until the call succeeds or <paramref name="maxWaitTime"/> has elapsed. If the timeout /// has elapsed and the call fails, the <see cref="OutOfMemoryException"/> is rethrown. /// </remarks> public static void Execute(RetryableCommand retryableCommand, TimeSpan maxWaitTime) { new RetryableCommandExecutor(retryableCommand, maxWaitTime).Execute(); }
/// <summary> /// Executes the given <see cref="RetryableCommand"/> inside the memory manager. /// </summary> /// <remarks> /// The <see cref="RetryableCommand"/> will be executed at least once, but may be called /// repeatedly in the case where it throws an <see cref="OutOfMemoryException"/>. When the /// <see cref="RetryableCommand"/> does throw an <see cref="OutOfMemoryException"/>, a memory /// collection will be triggered and the memory manager will continue to call the <see cref="RetryableCommand"/> /// until the call succeeds or the default timeout of 1 second has elapsed. If the timeout /// has elapsed and the call fails, the <see cref="OutOfMemoryException"/> is rethrown. /// </remarks> public static void Execute(RetryableCommand retryableCommand) { Execute(retryableCommand, _defaultWaitTimeMilliseconds); }