Class MinimalFuture<T>
- java.lang.Object
-
- java.util.concurrent.CompletableFuture<T>
-
- jdk.incubator.http.internal.common.MinimalFuture<T>
-
public final class MinimalFuture<T> extends java.util.concurrent.CompletableFuture<T>
-
-
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 givenCompletionStage
.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
-
-
-
-
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 givenCompletionStage
.Might be useful both for producers and consumers of
CompletionStage
s.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 theCompletionStage
's result- Parameters:
src
- theCompletionStage
to make a copy fromexecutor
- the executor used to propagate the completion- Returns:
- a copy of the given stage
-
newIncompleteFuture
public <U> MinimalFuture<U> newIncompleteFuture()
- Overrides:
newIncompleteFuture
in classjava.util.concurrent.CompletableFuture<T>
-
obtrudeValue
public void obtrudeValue(T value)
- Overrides:
obtrudeValue
in classjava.util.concurrent.CompletableFuture<T>
-
obtrudeException
public void obtrudeException(java.lang.Throwable ex)
- Overrides:
obtrudeException
in classjava.util.concurrent.CompletableFuture<T>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.util.concurrent.CompletableFuture<T>
-
-