Class OperationTimedPollAlgorithm

  • All Implemented Interfaces:
    TimedRetryAlgorithm, TimedRetryAlgorithmWithContext

    public class OperationTimedPollAlgorithm
    extends ExponentialRetryAlgorithm
    Operation timed polling algorithm, which uses exponential backoff factor for determining when the next polling operation should be executed. If the polling exceeds the total timeout this algorithm cancels polling.
    • Method Detail

      • create

        public static OperationTimedPollAlgorithm create​(RetrySettings globalSettings)
        Creates the polling algorithm, using the default NanoClock for time computations.
        Parameters:
        globalSettings - the settings
        Returns:
        timed poll algorithm
      • shouldRetry

        public boolean shouldRetry​(TimedAttemptSettings nextAttemptSettings)
                            throws java.util.concurrent.CancellationException
        Returns true if another poll operation should be made or throws CancellationException otherwise.
        Specified by:
        shouldRetry in interface TimedRetryAlgorithm
        Overrides:
        shouldRetry in class ExponentialRetryAlgorithm
        Parameters:
        nextAttemptSettings - attempt settings, which will be used for the next attempt, if accepted
        Returns:
        true if more attempts should be made, never returns false (throws CancellationException instead)
        Throws:
        java.util.concurrent.CancellationException - if no more attempts should be made