Class RetryPolicy

  • All Implemented Interfaces:
    Serializable

    public final class RetryPolicy
    extends Policy
    The resolved "cached" information of a Retry annotation an a specific method.
    Author:
    Jan Bernitt
    See Also:
    Serialized Form
    • Field Detail

      • maxRetries

        public final int maxRetries
      • delay

        public final long delay
      • maxDuration

        public final long maxDuration
      • durationUnit

        public final ChronoUnit durationUnit
      • jitter

        public final long jitter
      • jitterDelayUnit

        public final ChronoUnit jitterDelayUnit
    • Method Detail

      • isNone

        public boolean isNone()
      • retryOn

        public boolean retryOn​(Throwable ex)
        Should a retry occur then the given Throwable is thrown? Relevant section from Retry javadocs:
        When a method returns and the retry policy is present, the following rules are applied:
        1. If the method returns normally (doesn't throw), the result is simply returned.
        2. Otherwise, if the thrown object is assignable to any value in the #abortOn() parameter, the thrown object is rethrown.
        3. Otherwise, if the thrown object is assignable to any value in the #retryOn() parameter, the method call is retried.
        4. Otherwise the thrown object is rethrown.
        Parameters:
        ex - an Error or an Exception
        Returns:
        true, if a retry should occur, else false.
      • timeoutTimeNow

        public Long timeoutTimeNow()
      • isDelayed

        public boolean isDelayed()
      • jitteredDelay

        public long jitteredDelay()
      • totalAttempts

        public int totalAttempts()
      • isMaxRetriesSet

        public boolean isMaxRetriesSet()
      • isMaxDurationSet

        public boolean isMaxDurationSet()