类 FixedBackOffPolicy

java.lang.Object
infra.retry.backoff.StatelessBackOffPolicy
infra.retry.backoff.FixedBackOffPolicy
所有已实现的接口:
BackOffPolicy, SleepingBackOffPolicy<FixedBackOffPolicy>

public class FixedBackOffPolicy extends StatelessBackOffPolicy implements SleepingBackOffPolicy<FixedBackOffPolicy>
Implementation of BackOffPolicy that pauses for a fixed period of time before continuing. A pause is implemented using Sleeper.sleep(long). setBackOffPeriod(long) is thread-safe and it is safe to call setBackOffPeriod(long) during execution from multiple threads, however this may cause a single retry operation to have pauses of different intervals.
从以下版本开始:
4.0
作者:
Rob Harrop, Dave Syer, Artem Bilan, Harry Yang
  • 字段详细资料

    • DEFAULT_BACK_OFF_PERIOD

      private static final long DEFAULT_BACK_OFF_PERIOD
      Default back off period - 1000ms.
      另请参阅:
    • backOffPeriod

      private Supplier<Long> backOffPeriod
      The back off period in milliseconds. Defaults to 1000ms.
    • sleeper

      private Sleeper sleeper
  • 构造器详细资料

    • FixedBackOffPolicy

      public FixedBackOffPolicy()
  • 方法详细资料

    • withSleeper

      public FixedBackOffPolicy withSleeper(Sleeper sleeper)
      从接口复制的说明: SleepingBackOffPolicy
      Clone the policy and return a new policy which uses the passed sleeper.
      指定者:
      withSleeper 在接口中 SleepingBackOffPolicy<FixedBackOffPolicy>
      参数:
      sleeper - Target to be invoked any time the backoff policy sleeps
      返回:
      a clone of this policy which will have all of its backoff sleeps routed into the passed sleeper
    • setSleeper

      public void setSleeper(Sleeper sleeper)
      Public setter for the Sleeper strategy.
      参数:
      sleeper - the sleeper to set defaults to ThreadWaitSleeper.
    • setBackOffPeriod

      public void setBackOffPeriod(long backOffPeriod)
      Set the back off period in milliseconds. Cannot be < 1. Default value is 1000ms.
      参数:
      backOffPeriod - the back off period
    • backOffPeriodSupplier

      public void backOffPeriodSupplier(Supplier<Long> backOffPeriodSupplier)
      Set a supplier for the back off period in milliseconds. Cannot be < 1. Default supplier supplies 1000ms.
      参数:
      backOffPeriodSupplier - the back off period
    • getBackOffPeriod

      public long getBackOffPeriod()
      The backoff period in milliseconds.
      返回:
      the backoff period
    • doBackOff

      protected void doBackOff() throws BackOffInterruptedException
      Pause for the setBackOffPeriod(long).
      指定者:
      doBackOff 在类中 StatelessBackOffPolicy
      抛出:
      BackOffInterruptedException - if interrupted during sleep.
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object