Class BlockingAwareFuture<T>

  • All Implemented Interfaces:
    java.util.concurrent.CompletionStage<T>, java.util.concurrent.Future<T>

    public class BlockingAwareFuture<T>
    extends java.util.concurrent.CompletableFuture<T>
    A CompletableFuture that tracks whether the future or one of its descendants has been blocked on a CompletableFuture.get() or CompletableFuture.join() call.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.concurrent.CompletableFuture

        java.util.concurrent.CompletableFuture.AsynchronousCompletionTask
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.concurrent.CompletableFuture<java.lang.Void> acceptEither​(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Consumer<? super T> action)  
      java.util.concurrent.CompletableFuture<java.lang.Void> acceptEitherAsync​(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Consumer<? super T> action)  
      java.util.concurrent.CompletableFuture<java.lang.Void> acceptEitherAsync​(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Consumer<? super T> action, java.util.concurrent.Executor executor)  
      <U> java.util.concurrent.CompletableFuture<U> applyToEither​(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Function<? super T,​U> fn)  
      <U> java.util.concurrent.CompletableFuture<U> applyToEitherAsync​(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Function<? super T,​U> fn)  
      <U> java.util.concurrent.CompletableFuture<U> applyToEitherAsync​(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Function<? super T,​U> fn, java.util.concurrent.Executor executor)  
      T get()  
      T get​(long timeout, java.util.concurrent.TimeUnit unit)  
      <U> java.util.concurrent.CompletableFuture<U> handle​(java.util.function.BiFunction<? super T,​java.lang.Throwable,​? extends U> fn)  
      <U> java.util.concurrent.CompletableFuture<U> handleAsync​(java.util.function.BiFunction<? super T,​java.lang.Throwable,​? extends U> fn)  
      <U> java.util.concurrent.CompletableFuture<U> handleAsync​(java.util.function.BiFunction<? super T,​java.lang.Throwable,​? extends U> fn, java.util.concurrent.Executor executor)  
      boolean isBlocked()
      Returns a boolean indicating whether the future is blocked.
      T join()  
      java.util.concurrent.CompletableFuture<java.lang.Void> runAfterBoth​(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action)  
      java.util.concurrent.CompletableFuture<java.lang.Void> runAfterBothAsync​(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action)  
      java.util.concurrent.CompletableFuture<java.lang.Void> runAfterBothAsync​(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action, java.util.concurrent.Executor executor)  
      java.util.concurrent.CompletableFuture<java.lang.Void> runAfterEither​(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action)  
      java.util.concurrent.CompletableFuture<java.lang.Void> runAfterEitherAsync​(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action)  
      java.util.concurrent.CompletableFuture<java.lang.Void> runAfterEitherAsync​(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action, java.util.concurrent.Executor executor)  
      java.util.concurrent.CompletableFuture<java.lang.Void> thenAccept​(java.util.function.Consumer<? super T> action)  
      java.util.concurrent.CompletableFuture<java.lang.Void> thenAcceptAsync​(java.util.function.Consumer<? super T> action)  
      java.util.concurrent.CompletableFuture<java.lang.Void> thenAcceptAsync​(java.util.function.Consumer<? super T> action, java.util.concurrent.Executor executor)  
      <U> java.util.concurrent.CompletableFuture<java.lang.Void> thenAcceptBoth​(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiConsumer<? super T,​? super U> action)  
      <U> java.util.concurrent.CompletableFuture<java.lang.Void> thenAcceptBothAsync​(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiConsumer<? super T,​? super U> action)  
      <U> java.util.concurrent.CompletableFuture<java.lang.Void> thenAcceptBothAsync​(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiConsumer<? super T,​? super U> action, java.util.concurrent.Executor executor)  
      <U> java.util.concurrent.CompletableFuture<U> thenApply​(java.util.function.Function<? super T,​? extends U> fn)  
      <U> java.util.concurrent.CompletableFuture<U> thenApplyAsync​(java.util.function.Function<? super T,​? extends U> fn)  
      <U> java.util.concurrent.CompletableFuture<U> thenApplyAsync​(java.util.function.Function<? super T,​? extends U> fn, java.util.concurrent.Executor executor)  
      <U,​V>
      java.util.concurrent.CompletableFuture<V>
      thenCombine​(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiFunction<? super T,​? super U,​? extends V> fn)  
      <U,​V>
      java.util.concurrent.CompletableFuture<V>
      thenCombineAsync​(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiFunction<? super T,​? super U,​? extends V> fn)  
      <U,​V>
      java.util.concurrent.CompletableFuture<V>
      thenCombineAsync​(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiFunction<? super T,​? super U,​? extends V> fn, java.util.concurrent.Executor executor)  
      <U> java.util.concurrent.CompletableFuture<U> thenCompose​(java.util.function.Function<? super T,​? extends java.util.concurrent.CompletionStage<U>> fn)  
      <U> java.util.concurrent.CompletableFuture<U> thenComposeAsync​(java.util.function.Function<? super T,​? extends java.util.concurrent.CompletionStage<U>> fn)  
      <U> java.util.concurrent.CompletableFuture<U> thenComposeAsync​(java.util.function.Function<? super T,​? extends java.util.concurrent.CompletionStage<U>> fn, java.util.concurrent.Executor executor)  
      java.util.concurrent.CompletableFuture<java.lang.Void> thenRun​(java.lang.Runnable action)  
      java.util.concurrent.CompletableFuture<java.lang.Void> thenRunAsync​(java.lang.Runnable action)  
      java.util.concurrent.CompletableFuture<java.lang.Void> thenRunAsync​(java.lang.Runnable action, java.util.concurrent.Executor executor)  
      java.util.concurrent.CompletableFuture<T> whenComplete​(java.util.function.BiConsumer<? super T,​? super java.lang.Throwable> action)  
      java.util.concurrent.CompletableFuture<T> whenCompleteAsync​(java.util.function.BiConsumer<? super T,​? super java.lang.Throwable> action)  
      java.util.concurrent.CompletableFuture<T> whenCompleteAsync​(java.util.function.BiConsumer<? super T,​? super java.lang.Throwable> action, java.util.concurrent.Executor executor)  
      • Methods inherited from class java.util.concurrent.CompletableFuture

        allOf, anyOf, cancel, complete, completeAsync, completeAsync, completedFuture, completedStage, completeExceptionally, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionally, failedFuture, failedStage, getNow, getNumberOfDependents, isCancelled, isCompletedExceptionally, isDone, minimalCompletionStage, newIncompleteFuture, obtrudeException, obtrudeValue, orTimeout, runAsync, runAsync, supplyAsync, supplyAsync, toCompletableFuture, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • BlockingAwareFuture

        public BlockingAwareFuture()
    • Method Detail

      • isBlocked

        public boolean isBlocked()
        Returns a boolean indicating whether the future is blocked.
        Returns:
        indicates whether the future is blocked
      • get

        public T get()
              throws java.lang.InterruptedException,
                     java.util.concurrent.ExecutionException
        Specified by:
        get in interface java.util.concurrent.Future<T>
        Overrides:
        get in class java.util.concurrent.CompletableFuture<T>
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
      • get

        public T get​(long timeout,
                     java.util.concurrent.TimeUnit unit)
              throws java.lang.InterruptedException,
                     java.util.concurrent.ExecutionException,
                     java.util.concurrent.TimeoutException
        Specified by:
        get in interface java.util.concurrent.Future<T>
        Overrides:
        get in class java.util.concurrent.CompletableFuture<T>
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
        java.util.concurrent.TimeoutException
      • join

        public T join()
        Overrides:
        join in class java.util.concurrent.CompletableFuture<T>
      • thenApply

        public <U> java.util.concurrent.CompletableFuture<U> thenApply​(java.util.function.Function<? super T,​? extends U> fn)
        Specified by:
        thenApply in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenApply in class java.util.concurrent.CompletableFuture<T>
      • thenApplyAsync

        public <U> java.util.concurrent.CompletableFuture<U> thenApplyAsync​(java.util.function.Function<? super T,​? extends U> fn)
        Specified by:
        thenApplyAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenApplyAsync in class java.util.concurrent.CompletableFuture<T>
      • thenApplyAsync

        public <U> java.util.concurrent.CompletableFuture<U> thenApplyAsync​(java.util.function.Function<? super T,​? extends U> fn,
                                                                            java.util.concurrent.Executor executor)
        Specified by:
        thenApplyAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenApplyAsync in class java.util.concurrent.CompletableFuture<T>
      • thenAccept

        public java.util.concurrent.CompletableFuture<java.lang.Void> thenAccept​(java.util.function.Consumer<? super T> action)
        Specified by:
        thenAccept in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenAccept in class java.util.concurrent.CompletableFuture<T>
      • thenAcceptAsync

        public java.util.concurrent.CompletableFuture<java.lang.Void> thenAcceptAsync​(java.util.function.Consumer<? super T> action)
        Specified by:
        thenAcceptAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenAcceptAsync in class java.util.concurrent.CompletableFuture<T>
      • thenAcceptAsync

        public java.util.concurrent.CompletableFuture<java.lang.Void> thenAcceptAsync​(java.util.function.Consumer<? super T> action,
                                                                                      java.util.concurrent.Executor executor)
        Specified by:
        thenAcceptAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenAcceptAsync in class java.util.concurrent.CompletableFuture<T>
      • thenRun

        public java.util.concurrent.CompletableFuture<java.lang.Void> thenRun​(java.lang.Runnable action)
        Specified by:
        thenRun in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenRun in class java.util.concurrent.CompletableFuture<T>
      • thenRunAsync

        public java.util.concurrent.CompletableFuture<java.lang.Void> thenRunAsync​(java.lang.Runnable action)
        Specified by:
        thenRunAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenRunAsync in class java.util.concurrent.CompletableFuture<T>
      • thenRunAsync

        public java.util.concurrent.CompletableFuture<java.lang.Void> thenRunAsync​(java.lang.Runnable action,
                                                                                   java.util.concurrent.Executor executor)
        Specified by:
        thenRunAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenRunAsync in class java.util.concurrent.CompletableFuture<T>
      • thenCombine

        public <U,​V> java.util.concurrent.CompletableFuture<V> thenCombine​(java.util.concurrent.CompletionStage<? extends U> other,
                                                                                 java.util.function.BiFunction<? super T,​? super U,​? extends V> fn)
        Specified by:
        thenCombine in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenCombine in class java.util.concurrent.CompletableFuture<T>
      • thenCombineAsync

        public <U,​V> java.util.concurrent.CompletableFuture<V> thenCombineAsync​(java.util.concurrent.CompletionStage<? extends U> other,
                                                                                      java.util.function.BiFunction<? super T,​? super U,​? extends V> fn)
        Specified by:
        thenCombineAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenCombineAsync in class java.util.concurrent.CompletableFuture<T>
      • thenCombineAsync

        public <U,​V> java.util.concurrent.CompletableFuture<V> thenCombineAsync​(java.util.concurrent.CompletionStage<? extends U> other,
                                                                                      java.util.function.BiFunction<? super T,​? super U,​? extends V> fn,
                                                                                      java.util.concurrent.Executor executor)
        Specified by:
        thenCombineAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenCombineAsync in class java.util.concurrent.CompletableFuture<T>
      • thenAcceptBoth

        public <U> java.util.concurrent.CompletableFuture<java.lang.Void> thenAcceptBoth​(java.util.concurrent.CompletionStage<? extends U> other,
                                                                                         java.util.function.BiConsumer<? super T,​? super U> action)
        Specified by:
        thenAcceptBoth in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenAcceptBoth in class java.util.concurrent.CompletableFuture<T>
      • thenAcceptBothAsync

        public <U> java.util.concurrent.CompletableFuture<java.lang.Void> thenAcceptBothAsync​(java.util.concurrent.CompletionStage<? extends U> other,
                                                                                              java.util.function.BiConsumer<? super T,​? super U> action)
        Specified by:
        thenAcceptBothAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenAcceptBothAsync in class java.util.concurrent.CompletableFuture<T>
      • thenAcceptBothAsync

        public <U> java.util.concurrent.CompletableFuture<java.lang.Void> thenAcceptBothAsync​(java.util.concurrent.CompletionStage<? extends U> other,
                                                                                              java.util.function.BiConsumer<? super T,​? super U> action,
                                                                                              java.util.concurrent.Executor executor)
        Specified by:
        thenAcceptBothAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenAcceptBothAsync in class java.util.concurrent.CompletableFuture<T>
      • runAfterBoth

        public java.util.concurrent.CompletableFuture<java.lang.Void> runAfterBoth​(java.util.concurrent.CompletionStage<?> other,
                                                                                   java.lang.Runnable action)
        Specified by:
        runAfterBoth in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        runAfterBoth in class java.util.concurrent.CompletableFuture<T>
      • runAfterBothAsync

        public java.util.concurrent.CompletableFuture<java.lang.Void> runAfterBothAsync​(java.util.concurrent.CompletionStage<?> other,
                                                                                        java.lang.Runnable action)
        Specified by:
        runAfterBothAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        runAfterBothAsync in class java.util.concurrent.CompletableFuture<T>
      • runAfterBothAsync

        public java.util.concurrent.CompletableFuture<java.lang.Void> runAfterBothAsync​(java.util.concurrent.CompletionStage<?> other,
                                                                                        java.lang.Runnable action,
                                                                                        java.util.concurrent.Executor executor)
        Specified by:
        runAfterBothAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        runAfterBothAsync in class java.util.concurrent.CompletableFuture<T>
      • applyToEither

        public <U> java.util.concurrent.CompletableFuture<U> applyToEither​(java.util.concurrent.CompletionStage<? extends T> other,
                                                                           java.util.function.Function<? super T,​U> fn)
        Specified by:
        applyToEither in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        applyToEither in class java.util.concurrent.CompletableFuture<T>
      • applyToEitherAsync

        public <U> java.util.concurrent.CompletableFuture<U> applyToEitherAsync​(java.util.concurrent.CompletionStage<? extends T> other,
                                                                                java.util.function.Function<? super T,​U> fn)
        Specified by:
        applyToEitherAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        applyToEitherAsync in class java.util.concurrent.CompletableFuture<T>
      • applyToEitherAsync

        public <U> java.util.concurrent.CompletableFuture<U> applyToEitherAsync​(java.util.concurrent.CompletionStage<? extends T> other,
                                                                                java.util.function.Function<? super T,​U> fn,
                                                                                java.util.concurrent.Executor executor)
        Specified by:
        applyToEitherAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        applyToEitherAsync in class java.util.concurrent.CompletableFuture<T>
      • acceptEither

        public java.util.concurrent.CompletableFuture<java.lang.Void> acceptEither​(java.util.concurrent.CompletionStage<? extends T> other,
                                                                                   java.util.function.Consumer<? super T> action)
        Specified by:
        acceptEither in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        acceptEither in class java.util.concurrent.CompletableFuture<T>
      • acceptEitherAsync

        public java.util.concurrent.CompletableFuture<java.lang.Void> acceptEitherAsync​(java.util.concurrent.CompletionStage<? extends T> other,
                                                                                        java.util.function.Consumer<? super T> action)
        Specified by:
        acceptEitherAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        acceptEitherAsync in class java.util.concurrent.CompletableFuture<T>
      • acceptEitherAsync

        public java.util.concurrent.CompletableFuture<java.lang.Void> acceptEitherAsync​(java.util.concurrent.CompletionStage<? extends T> other,
                                                                                        java.util.function.Consumer<? super T> action,
                                                                                        java.util.concurrent.Executor executor)
        Specified by:
        acceptEitherAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        acceptEitherAsync in class java.util.concurrent.CompletableFuture<T>
      • runAfterEither

        public java.util.concurrent.CompletableFuture<java.lang.Void> runAfterEither​(java.util.concurrent.CompletionStage<?> other,
                                                                                     java.lang.Runnable action)
        Specified by:
        runAfterEither in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        runAfterEither in class java.util.concurrent.CompletableFuture<T>
      • runAfterEitherAsync

        public java.util.concurrent.CompletableFuture<java.lang.Void> runAfterEitherAsync​(java.util.concurrent.CompletionStage<?> other,
                                                                                          java.lang.Runnable action)
        Specified by:
        runAfterEitherAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        runAfterEitherAsync in class java.util.concurrent.CompletableFuture<T>
      • runAfterEitherAsync

        public java.util.concurrent.CompletableFuture<java.lang.Void> runAfterEitherAsync​(java.util.concurrent.CompletionStage<?> other,
                                                                                          java.lang.Runnable action,
                                                                                          java.util.concurrent.Executor executor)
        Specified by:
        runAfterEitherAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        runAfterEitherAsync in class java.util.concurrent.CompletableFuture<T>
      • thenCompose

        public <U> java.util.concurrent.CompletableFuture<U> thenCompose​(java.util.function.Function<? super T,​? extends java.util.concurrent.CompletionStage<U>> fn)
        Specified by:
        thenCompose in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenCompose in class java.util.concurrent.CompletableFuture<T>
      • thenComposeAsync

        public <U> java.util.concurrent.CompletableFuture<U> thenComposeAsync​(java.util.function.Function<? super T,​? extends java.util.concurrent.CompletionStage<U>> fn)
        Specified by:
        thenComposeAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenComposeAsync in class java.util.concurrent.CompletableFuture<T>
      • thenComposeAsync

        public <U> java.util.concurrent.CompletableFuture<U> thenComposeAsync​(java.util.function.Function<? super T,​? extends java.util.concurrent.CompletionStage<U>> fn,
                                                                              java.util.concurrent.Executor executor)
        Specified by:
        thenComposeAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        thenComposeAsync in class java.util.concurrent.CompletableFuture<T>
      • whenComplete

        public java.util.concurrent.CompletableFuture<T> whenComplete​(java.util.function.BiConsumer<? super T,​? super java.lang.Throwable> action)
        Specified by:
        whenComplete in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        whenComplete in class java.util.concurrent.CompletableFuture<T>
      • whenCompleteAsync

        public java.util.concurrent.CompletableFuture<T> whenCompleteAsync​(java.util.function.BiConsumer<? super T,​? super java.lang.Throwable> action)
        Specified by:
        whenCompleteAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        whenCompleteAsync in class java.util.concurrent.CompletableFuture<T>
      • whenCompleteAsync

        public java.util.concurrent.CompletableFuture<T> whenCompleteAsync​(java.util.function.BiConsumer<? super T,​? super java.lang.Throwable> action,
                                                                           java.util.concurrent.Executor executor)
        Specified by:
        whenCompleteAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        whenCompleteAsync in class java.util.concurrent.CompletableFuture<T>
      • handle

        public <U> java.util.concurrent.CompletableFuture<U> handle​(java.util.function.BiFunction<? super T,​java.lang.Throwable,​? extends U> fn)
        Specified by:
        handle in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        handle in class java.util.concurrent.CompletableFuture<T>
      • handleAsync

        public <U> java.util.concurrent.CompletableFuture<U> handleAsync​(java.util.function.BiFunction<? super T,​java.lang.Throwable,​? extends U> fn)
        Specified by:
        handleAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        handleAsync in class java.util.concurrent.CompletableFuture<T>
      • handleAsync

        public <U> java.util.concurrent.CompletableFuture<U> handleAsync​(java.util.function.BiFunction<? super T,​java.lang.Throwable,​? extends U> fn,
                                                                         java.util.concurrent.Executor executor)
        Specified by:
        handleAsync in interface java.util.concurrent.CompletionStage<T>
        Overrides:
        handleAsync in class java.util.concurrent.CompletableFuture<T>