java.lang.Object
software.amazon.cloudformation.proxy.delay.Blended
All Implemented Interfaces:
Delay

public class Blended
extends java.lang.Object
implements Delay
Provides blended delay of seconds for each attempt until all delays in the order start to return Duration.ZERO. This is useful to model blends in the delays where on can be quick for the first set of delays using Constant and then become MultipleOf or Exponential thereafter. final Delay delay = Blended.of() .add( Constant.of().delay(Duration.ofSeconds(5)) .timeout(Duration.ofSeconds(20)).build()) .add(ShiftByMultipleOf.shiftedOf() .delay(Duration.ofSeconds(5)).timeout(Duration.ofSeconds(220)) .build()) .build(); The above delay provides the following set of 5, 10, 15, 20, 40, 90, 150, 220
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  Blended.BlendedBuilder  
  • Method Summary

    Modifier and Type Method Description
    java.time.Duration nextDelay​(int attempt)
    Returns the new delay amount to stabilize as defined by Duration time.
    static Blended.BlendedBuilder of()  

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • of

      public static Blended.BlendedBuilder of()
    • nextDelay

      public java.time.Duration nextDelay​(int attempt)
      Description copied from interface: Delay
      Returns the new delay amount to stabilize as defined by Duration time. This returns -1 to indicate that we are done with delays from this instance Different implementations can return different values
      Specified by:
      nextDelay in interface Delay
      Parameters:
      attempt - , starts with 1
      Returns:
      the next amount to wait for or Duration.ZERO to indicate delay is complete