Interface ExponentialBackOff

All Known Implementing Classes:
ExponentialBackOffImpl

@Experimental public interface ExponentialBackOff
Interface to implement an exponential back-off algorithm that retries the request based on the result of the remote operation.

This interface contains 2 methods: asyncBackOff() ()} which should be invoked if the request needs to be retried and reset(), invoked when a request is "successful", which resets the state.

Since:
12.0
Author:
Pedro Ruivo
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ExponentialBackOff
    Disabled exponential back-off algorithm.
  • Method Summary

    Modifier and Type
    Method
    Description
    It returns a CompletionStage which is completed a certain amount of time before retries the request.
    void
    Resets its state.
  • Field Details

    • NO_OP

      static final ExponentialBackOff NO_OP
      Disabled exponential back-off algorithm. It does nothing.
  • Method Details

    • reset

      void reset()
      Resets its state.

      The blocking time in asyncBackOff() increases with the number of consecutive retries. This methods resets its state back to the initial sleep time.

    • asyncBackOff

      CompletionStage<Void> asyncBackOff()
      It returns a CompletionStage which is completed a certain amount of time before retries the request.

      After the completion, the request is allows to proceed.

      Returns:
      A CompletionStage.