Class MinimalFuture<T>



  • public final class MinimalFuture<T>
    extends java.util.concurrent.CompletableFuture<T>
    • Nested Class Summary

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

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

      Constructors 
      Constructor Description
      MinimalFuture()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <U> MinimalFuture<U> completedFuture(U value)  
      static <T> MinimalFuture<T> copy(java.util.concurrent.CompletionStage<T> src, java.util.concurrent.Executor executor)
      Creates a defensive copy of the given CompletionStage.
      static <U> java.util.concurrent.CompletableFuture<U> failedFuture(java.lang.Throwable ex)  
      <U> MinimalFuture<U> newIncompleteFuture()  
      void obtrudeException(java.lang.Throwable ex)  
      void obtrudeValue(T value)  
      java.lang.String toString()  
      • Methods inherited from class java.util.concurrent.CompletableFuture

        acceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, cancel, complete, completeAsync, completeAsync, completedStage, completeExceptionally, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionally, failedStage, get, get, getNow, getNumberOfDependents, handle, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, join, minimalCompletionStage, orTimeout, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, supplyAsync, supplyAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, whenComplete, whenCompleteAsync, whenCompleteAsync
      • Methods inherited from class java.lang.Object

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

      • MinimalFuture

        public MinimalFuture()
    • Method Detail

      • completedFuture

        public static <U> MinimalFuture<U> completedFuture(U value)
      • failedFuture

        public static <U> java.util.concurrent.CompletableFuture<U> failedFuture(java.lang.Throwable ex)
      • copy

        public static <T> MinimalFuture<T> copy(java.util.concurrent.CompletionStage<T> src,
                                                java.util.concurrent.Executor executor)
        Creates a defensive copy of the given CompletionStage.

        Might be useful both for producers and consumers of CompletionStages.

        Producers are protected from possible uncontrolled modifications (cancellation, completion, obtrusion, etc.) as well as from executing unknown potentially lengthy or faulty dependants in the given CompletionStage's default execution facility or synchronously.

        Consumers are protected from some of the aspects of misbehaving implementations (e.g. accepting results, applying functions, running tasks, etc. more than once or escape of a reference to their private executor, etc.) by providing a reliable proxy they use instead.

        Type Parameters:
        T - the type of the CompletionStage's result
        Parameters:
        src - the CompletionStage to make a copy from
        executor - the executor used to propagate the completion
        Returns:
        a copy of the given stage
      • newIncompleteFuture

        public <U> MinimalFuture<U> newIncompleteFuture()
        Overrides:
        newIncompleteFuture in class java.util.concurrent.CompletableFuture<T>
      • obtrudeValue

        public void obtrudeValue(T value)
        Overrides:
        obtrudeValue in class java.util.concurrent.CompletableFuture<T>
      • obtrudeException

        public void obtrudeException(java.lang.Throwable ex)
        Overrides:
        obtrudeException in class java.util.concurrent.CompletableFuture<T>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.util.concurrent.CompletableFuture<T>