Class IterativePollInterval

java.lang.Object
org.awaitility.pollinterval.IterativePollInterval
All Implemented Interfaces:
PollInterval

public class IterativePollInterval extends Object implements PollInterval
A poll interval that is generated by a function and a start duration. The function is free to do anything with the duration. For example:
 await().with().pollInterval(iterative(duration -> duration.multiply(2)), Duration.FIVE_HUNDRED_MILLISECONDS).until(..);
 
This generates a poll interval sequence that looks like this (ms): 500, 1000, 2000, 4000, 8000, 16000, ...

Note that if the user specifies a poll delay this delay will take place before the first call to next(int, Duration).

  • Field Details

  • Constructor Details

    • IterativePollInterval

      public IterativePollInterval(Function<Duration,Duration> function)
      Generate an iterative poll interval based on the supplied function.
      Parameters:
      function - The function to use.
    • IterativePollInterval

      public IterativePollInterval(Function<Duration,Duration> function, Duration startDuration)
      Generate a iterative poll interval based on the supplied function and start duration.
      Parameters:
      function - The function to use.
      startDuration - The start duration (initial function value)
    • IterativePollInterval

      private IterativePollInterval(Function<Duration,Duration> function, Duration startDuration, boolean startDurationExplicitlyDefined)
      Generate a iterative poll interval based on the supplied function and start duration.
      Parameters:
      function - The function to use.
      startDuration - The start duration (initial function value)
  • Method Details