类 Retryer.Builder<V>

  • 封闭类:
    Retryer<V>

    public static class Retryer.Builder<V>
    extends Object
    • 构造器详细资料

      • Builder

        public Builder()
    • 方法详细资料

      • withMaxRetry

        public Retryer.Builder<V> withMaxRetry​(int maxRetry)
        Max Retry count
        参数:
        maxRetry - is required, missing will caused exception
        返回:
      • withProcedureRetry

        public Retryer.Builder<V> withProcedureRetry​(int procedureRetry)
        Procedure retry count
        参数:
        procedureRetry - is not required, default value is 3
        返回:
      • withIntervalWaitInSecond

        public Retryer.Builder<V> withIntervalWaitInSecond​(int intervalWaitInSecond)
        Interval waiting time in second between each retrying
        参数:
        intervalWaitInSecond - is required, missing will caused exception
        返回:
      • withCondition

        public Retryer.Builder<V> withCondition​(Predicate<V> condition)
        Stop the retrying by test the condition. If condition result is true, then stop retrying
        参数:
        condition - is required, missing will caused exception
        返回:
      • withStopProcedure

        public Retryer.Builder<V> withStopProcedure​(Callable<Boolean> stopProcedure)
        Set a procedure after stop retrying
        Do nothing by default
        参数:
        stopProcedure -
        返回:
      • withRecoveryProcedure

        public Retryer.Builder<V> withRecoveryProcedure​(Callable<Boolean> recoveryProcedure)
        Set a recovery procedure after each retrying.
        Do nothing by default
        参数:
        recoveryProcedure -
        返回:
      • withStopByException

        public Retryer.Builder<V> withStopByException​(boolean stopByException)
        Stop retrying if stopByException is true and any exception is thrown
        Default set value is false, so continue retry if exception
        参数:
        stopByException -
        返回:
      • build

        public Retryer<V> build()
        Build a Retryer based on the configuration