Interface Awaitable<T>

    • Method Detail

      • toCompletableFuture

        CompletableFuture<T> toCompletableFuture()
        Returns a CompletableFuture maintaining the same completion properties as this stage. If this stage is already a CompletableFuture, this method may return this stage itself. Otherwise, invocation of this method may be equivalent in effect to thenApply(x -> x), but returning an instance of type CompletableFuture.
        Returns:
        the CompletableFuture
      • await

        default T await()
        Block until future is completed, throws only unchecked exceptions.
        Returns:
        T payload type
        Throws:
        CancellationException - if the computation was cancelled
        CompletionException - if this future completed
      • await

        default T await​(long timeout,
                        TimeUnit unit)
        Block until future is completed, throws only unchecked exceptions.
        Parameters:
        timeout - the maximum time to wait
        unit - the time unit of the timeout argument
        Returns:
        the result value
        Throws:
        CancellationException - if this future was cancelled
        CompletionException - if this future completed exceptionally, was interrupted while waiting or the wait timed out
      • await

        default T await​(Duration duration)
        Block until future is completed, throws only unchecked exceptions.
        Parameters:
        duration - the maximum time to wait
        Returns:
        the result value
        Throws:
        CancellationException - if this future was cancelled
        CompletionException - if this future completed exceptionally, was interrupted while waiting or the wait timed out