Class GenericWaiter


  • public class GenericWaiter
    extends Object
    Provides a basic waiter that will periodically poll for an update until a desired condition is met.
    • Method Detail

      • execute

        public <REQUEST,​RESPONSE> Optional<RESPONSE> execute​(Supplier<REQUEST> requestSupplier,
                                                                   Function<REQUEST,​RESPONSE> functionCall,
                                                                   Predicate<RESPONSE> terminationPredicate)
        Blocks until a specific condition is met.
        Type Parameters:
        REQUEST - Request object class
        RESPONSE - Response object class
        Parameters:
        requestSupplier - Supplier that provides a new request instance to fetch the current state.
        functionCall - Function that will be invoked to fetch the current state. It will be provided the request instance given by the requestSupplier.
        terminationPredicate - The termination predicate that will inspect the current state (returned response instance) to determine if it is done waiting.
        Returns:
        The last response object that was received and was accepted by the termination predicate, or empty if the waiter reached the max timeout.