Class RetryConfig

  • All Implemented Interfaces:
    java.io.Serializable

    public class RetryConfig
    extends java.lang.Object
    implements java.io.Serializable
    See Also:
    Serialized Form
    • Method Detail

      • ofDefaults

        public static RetryConfig ofDefaults()
        Creates a default Retry configuration.
        Returns:
        a default Retry configuration.
      • getMaxAttempts

        public int getMaxAttempts()
        Returns:
        the maximum allowed attempts to make.
      • isFailAfterMaxAttempts

        public boolean isFailAfterMaxAttempts()
        Returns:
        if exception should be thrown after max attempts are made with no satisfactory result
      • isWritableStackTraceEnabled

        public boolean isWritableStackTraceEnabled()
        Returns:
        if any thrown MaxRetriesExceededException should contain a stacktrace
      • getIntervalFunction

        @Nullable
        @Deprecated
        public java.util.function.Function<java.lang.Integer,​java.lang.Long> getIntervalFunction()
        Deprecated.
        Use intervalBiFunction instead, this method is kept for backwards compatibility
      • getIntervalBiFunction

        public <T> io.github.resilience4j.core.IntervalBiFunction<T> getIntervalBiFunction()
        Return the IntervalBiFunction which calculates wait interval based on result or exception
        Type Parameters:
        T - The type of result.
        Returns:
        the interval bi function
      • getExceptionPredicate

        public java.util.function.Predicate<java.lang.Throwable> getExceptionPredicate()
      • getResultPredicate

        @Nullable
        public <T> java.util.function.Predicate<T> getResultPredicate()
        Return the Predicate which evaluates if an result should be retried. The Predicate must return true if the result should be retried, otherwise it must return false.
        Type Parameters:
        T - The type of result.
        Returns:
        the result predicate