Interface Waiter<T>

  • Type Parameters:
    T - the type of the resource returned from the polling function
    All Known Implementing Classes:
    DefaultWaiter

    public interface Waiter<T>
    Waiter utility class that waits for a resource to transition to the desired state.
    • Method Detail

      • run

        default WaiterResponse<T> run​(Supplier<T> pollingFunction)
        It returns when the resource enters into a desired state or it is determined that the resource will never enter into the desired state.
        Parameters:
        pollingFunction - the polling function
        Returns:
        the WaiterResponse containing either a response or an exception that has matched with the waiter success condition
      • run

        default WaiterResponse<T> run​(Supplier<T> pollingFunction,
                                      WaiterOverrideConfiguration overrideConfig)
        It returns when the resource enters into a desired state or it is determined that the resource will never enter into the desired state.
        Parameters:
        pollingFunction - the polling function
        overrideConfig - per request override configuration
        Returns:
        the WaiterResponse containing either a response or an exception that has matched with the waiter success condition
      • run

        default WaiterResponse<T> run​(Supplier<T> pollingFunction,
                                      Consumer<WaiterOverrideConfiguration.Builder> overrideConfig)
        It returns when the resource enters into a desired state or it is determined that the resource will never enter into the desired state.
        Parameters:
        pollingFunction - the polling function
        overrideConfig - The consumer that will configure the per request override configuration for waiters
        Returns:
        the WaiterResponse containing either a response or an exception that has matched with the waiter success condition
      • builder

        static <T> Waiter.Builder<T> builder​(Class<? extends T> responseClass)
        Creates a newly initialized builder for the waiter object.
        Type Parameters:
        T - the type of the response
        Parameters:
        responseClass - the response class
        Returns:
        a Waiter builder