Class RetryOptions


  • public final class RetryOptions
    extends java.lang.Object
    • Method Detail

      • merge

        public static RetryOptions merge​(MethodRetry r,
                                         RetryOptions o)
        Merges annotation with explicitly provided RetryOptions. If there is conflict RetryOptions takes precedence.
      • addDoNotRetry

        @SafeVarargs
        public final RetryOptions addDoNotRetry​(java.lang.Class<? extends java.lang.Throwable>... doNotRetry)
      • getInitialInterval

        public java.time.Duration getInitialInterval()
      • getBackoffCoefficient

        public double getBackoffCoefficient()
      • getExpiration

        public java.time.Duration getExpiration()
      • getMaximumAttempts

        public int getMaximumAttempts()
      • getMaximumInterval

        public java.time.Duration getMaximumInterval()
      • validate

        public void validate()
      • getDoNotRetry

        public java.util.List<java.lang.Class<? extends java.lang.Throwable>> getDoNotRetry()
        Returns:
        null if not configured. When merging with annotation it makes a difference. null means use values from an annotation. Empty list means do not retry on anything.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • calculateSleepTime

        public long calculateSleepTime​(long attempt)
      • shouldRethrow

        public boolean shouldRethrow​(java.lang.Throwable e,
                                     long attempt,
                                     long elapsed,
                                     long sleepTime)