/** * The error case should be dealt with by retrying immediately with the given parameter. * @param parameter parameter or parameter object to retry with, can be a new one or the old one * @return strategy */ public static RetryStrategy retryImmediately(final Object parameter) { return new RetryStrategy(StrategyType.RETRY_IMMEDIATELY, null, parameter, null); }
/** * The error case should be dealt with by retrying later with the given parameter. * @param parameter parameter or parameter object to retry with, can be a new one or the old one * @param duration the amount of time to wait until the next try * @return strategy */ public static RetryStrategy retryScheduled(final Object parameter, final Duration duration) { return new RetryStrategy(StrategyType.RETRY_SCHEDULED, null, parameter, duration); }
/** * The error case should be dealt with giving up and throwing an exception. * * @param error the exception to throw * @return strategy */ public static RetryStrategy resume(final Throwable error) { return new RetryStrategy(StrategyType.RESUME, error, null, null); }
/** * The error case should cause the service to stop and throw an exception. * @param error the exception to throw * @return strategy */ public static RetryStrategy stop(final Throwable error) { return new RetryStrategy(StrategyType.STOP, error, null, null); }