Package io.smallrye.context
Class CompletableFutureWrapper<T>
java.lang.Object
java.util.concurrent.CompletableFuture<T>
io.smallrye.context.CompletableFutureWrapper<T>
- All Implemented Interfaces:
Contextualized,CompletionStage<T>,Future<T>
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.CompletableFuture
CompletableFuture.AsynchronousCompletionTask -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SmallRyeThreadContextprotected final ExecutorIf this executor is not null, we're wrapping a CF.protected final CompletableFuture<T>static final intstatic final intprotected final int -
Constructor Summary
ConstructorsConstructorDescriptionCompletableFutureWrapper(SmallRyeThreadContext context, CompletableFuture<T> f, Executor executor, int flags) -
Method Summary
Modifier and TypeMethodDescriptionacceptEither(CompletionStage<? extends T> other, Consumer<? super T> action) acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action) acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) <U> CompletableFuture<U>applyToEither(CompletionStage<? extends T> other, Function<? super T, U> fn) <U> CompletableFuture<U>applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn) <U> CompletableFuture<U>applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn, Executor executor) booleancancel(boolean mayInterruptIfRunning) protected voidbooleanbooleanbooleanexceptionally(Function<Throwable, ? extends T> fn) get()int<U> CompletableFuture<U>handle(BiFunction<? super T, Throwable, ? extends U> fn) <U> CompletableFuture<U>handleAsync(BiFunction<? super T, Throwable, ? extends U> fn) <U> CompletableFuture<U>handleAsync(BiFunction<? super T, Throwable, ? extends U> fn, Executor executor) inthashCode()booleanbooleanbooleanisDone()join()voidvoidobtrudeValue(T value) runAfterBoth(CompletionStage<?> other, Runnable action) runAfterBothAsync(CompletionStage<?> other, Runnable action) runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor) runAfterEither(CompletionStage<?> other, Runnable action) runAfterEitherAsync(CompletionStage<?> other, Runnable action) runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor) thenAccept(Consumer<? super T> action) thenAcceptAsync(Consumer<? super T> action) thenAcceptAsync(Consumer<? super T> action, Executor executor) <U> CompletableFuture<Void>thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) <U> CompletableFuture<Void>thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) <U> CompletableFuture<Void>thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action, Executor executor) <U> CompletableFuture<U><U> CompletableFuture<U>thenApplyAsync(Function<? super T, ? extends U> fn) <U> CompletableFuture<U>thenApplyAsync(Function<? super T, ? extends U> fn, Executor executor) <U,V> CompletableFuture<V> thenCombine(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) <U,V> CompletableFuture<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) <U,V> CompletableFuture<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) <U> CompletableFuture<U>thenCompose(Function<? super T, ? extends CompletionStage<U>> fn) <U> CompletableFuture<U>thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn) <U> CompletableFuture<U>thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn, Executor executor) thenRunAsync(Runnable action) thenRunAsync(Runnable action, Executor executor) toString()whenComplete(BiConsumer<? super T, ? super Throwable> action) whenCompleteAsync(BiConsumer<? super T, ? super Throwable> action) whenCompleteAsync(BiConsumer<? super T, ? super Throwable> action, Executor executor) Methods inherited from class java.util.concurrent.CompletableFuture
allOf, anyOf, completeAsync, completeAsync, completedFuture, completedStage, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionallyAsync, exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync, exceptionallyComposeAsync, failedFuture, failedStage, minimalCompletionStage, newIncompleteFuture, orTimeout, runAsync, runAsync, supplyAsync, supplyAsync
-
Field Details
-
f
-
context
-
executor
If this executor is not null, we're wrapping a CF. If it is null, we're a dependent stage of another CF, so we have different behaviour -
flags
protected final int flags -
FLAG_MINIMAL
public static final int FLAG_MINIMAL- See Also:
-
FLAG_DEPENDENT
public static final int FLAG_DEPENDENT- See Also:
-
-
Constructor Details
-
CompletableFutureWrapper
public CompletableFutureWrapper(SmallRyeThreadContext context, CompletableFuture<T> f, Executor executor, int flags)
-
-
Method Details
-
checkDefaultExecutor
protected void checkDefaultExecutor() -
complete
- Overrides:
completein classCompletableFuture<T>
-
completeExceptionally
- Overrides:
completeExceptionallyin classCompletableFuture<T>
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) -
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceFuture<T>- Overrides:
isCancelledin classCompletableFuture<T>
-
isCompletedExceptionally
public boolean isCompletedExceptionally()- Overrides:
isCompletedExceptionallyin classCompletableFuture<T>
-
obtrudeValue
- Overrides:
obtrudeValuein classCompletableFuture<T>
-
obtrudeException
- Overrides:
obtrudeExceptionin classCompletableFuture<T>
-
getNumberOfDependents
public int getNumberOfDependents()- Overrides:
getNumberOfDependentsin classCompletableFuture<T>
-
isDone
public boolean isDone() -
get
- Specified by:
getin interfaceFuture<T>- Overrides:
getin classCompletableFuture<T>- Throws:
InterruptedExceptionExecutionException
-
get
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
getin interfaceFuture<T>- Overrides:
getin classCompletableFuture<T>- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
join
- Overrides:
joinin classCompletableFuture<T>
-
getNow
- Overrides:
getNowin classCompletableFuture<T>
-
toCompletableFuture
- Specified by:
toCompletableFuturein interfaceCompletionStage<T>- Overrides:
toCompletableFuturein classCompletableFuture<T>
-
exceptionally
- Specified by:
exceptionallyin interfaceCompletionStage<T>- Overrides:
exceptionallyin classCompletableFuture<T>
-
handle
- Specified by:
handlein interfaceCompletionStage<T>- Overrides:
handlein classCompletableFuture<T>
-
handleAsync
- Specified by:
handleAsyncin interfaceCompletionStage<T>- Overrides:
handleAsyncin classCompletableFuture<T>
-
handleAsync
public <U> CompletableFuture<U> handleAsync(BiFunction<? super T, Throwable, ? extends U> fn, Executor executor) - Specified by:
handleAsyncin interfaceCompletionStage<T>- Overrides:
handleAsyncin classCompletableFuture<T>
-
thenApply
- Specified by:
thenApplyin interfaceCompletionStage<T>- Overrides:
thenApplyin classCompletableFuture<T>
-
thenApplyAsync
- Specified by:
thenApplyAsyncin interfaceCompletionStage<T>- Overrides:
thenApplyAsyncin classCompletableFuture<T>
-
thenApplyAsync
public <U> CompletableFuture<U> thenApplyAsync(Function<? super T, ? extends U> fn, Executor executor) - Specified by:
thenApplyAsyncin interfaceCompletionStage<T>- Overrides:
thenApplyAsyncin classCompletableFuture<T>
-
thenAccept
- Specified by:
thenAcceptin interfaceCompletionStage<T>- Overrides:
thenAcceptin classCompletableFuture<T>
-
thenAcceptAsync
- Specified by:
thenAcceptAsyncin interfaceCompletionStage<T>- Overrides:
thenAcceptAsyncin classCompletableFuture<T>
-
thenAcceptAsync
- Specified by:
thenAcceptAsyncin interfaceCompletionStage<T>- Overrides:
thenAcceptAsyncin classCompletableFuture<T>
-
thenRun
- Specified by:
thenRunin interfaceCompletionStage<T>- Overrides:
thenRunin classCompletableFuture<T>
-
thenRunAsync
- Specified by:
thenRunAsyncin interfaceCompletionStage<T>- Overrides:
thenRunAsyncin classCompletableFuture<T>
-
thenRunAsync
- Specified by:
thenRunAsyncin interfaceCompletionStage<T>- Overrides:
thenRunAsyncin classCompletableFuture<T>
-
thenCombine
public <U,V> CompletableFuture<V> thenCombine(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) - Specified by:
thenCombinein interfaceCompletionStage<T>- Overrides:
thenCombinein classCompletableFuture<T>
-
thenCombineAsync
public <U,V> CompletableFuture<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) - Specified by:
thenCombineAsyncin interfaceCompletionStage<T>- Overrides:
thenCombineAsyncin classCompletableFuture<T>
-
thenCombineAsync
public <U,V> CompletableFuture<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) - Specified by:
thenCombineAsyncin interfaceCompletionStage<T>- Overrides:
thenCombineAsyncin classCompletableFuture<T>
-
thenAcceptBoth
public <U> CompletableFuture<Void> thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) - Specified by:
thenAcceptBothin interfaceCompletionStage<T>- Overrides:
thenAcceptBothin classCompletableFuture<T>
-
thenAcceptBothAsync
public <U> CompletableFuture<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) - Specified by:
thenAcceptBothAsyncin interfaceCompletionStage<T>- Overrides:
thenAcceptBothAsyncin classCompletableFuture<T>
-
thenAcceptBothAsync
public <U> CompletableFuture<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action, Executor executor) - Specified by:
thenAcceptBothAsyncin interfaceCompletionStage<T>- Overrides:
thenAcceptBothAsyncin classCompletableFuture<T>
-
runAfterBoth
- Specified by:
runAfterBothin interfaceCompletionStage<T>- Overrides:
runAfterBothin classCompletableFuture<T>
-
runAfterBothAsync
- Specified by:
runAfterBothAsyncin interfaceCompletionStage<T>- Overrides:
runAfterBothAsyncin classCompletableFuture<T>
-
runAfterBothAsync
public CompletableFuture<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor) - Specified by:
runAfterBothAsyncin interfaceCompletionStage<T>- Overrides:
runAfterBothAsyncin classCompletableFuture<T>
-
applyToEither
public <U> CompletableFuture<U> applyToEither(CompletionStage<? extends T> other, Function<? super T, U> fn) - Specified by:
applyToEitherin interfaceCompletionStage<T>- Overrides:
applyToEitherin classCompletableFuture<T>
-
applyToEitherAsync
public <U> CompletableFuture<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn) - Specified by:
applyToEitherAsyncin interfaceCompletionStage<T>- Overrides:
applyToEitherAsyncin classCompletableFuture<T>
-
applyToEitherAsync
public <U> CompletableFuture<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn, Executor executor) - Specified by:
applyToEitherAsyncin interfaceCompletionStage<T>- Overrides:
applyToEitherAsyncin classCompletableFuture<T>
-
acceptEither
public CompletableFuture<Void> acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action) - Specified by:
acceptEitherin interfaceCompletionStage<T>- Overrides:
acceptEitherin classCompletableFuture<T>
-
acceptEitherAsync
public CompletableFuture<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action) - Specified by:
acceptEitherAsyncin interfaceCompletionStage<T>- Overrides:
acceptEitherAsyncin classCompletableFuture<T>
-
acceptEitherAsync
public CompletableFuture<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) - Specified by:
acceptEitherAsyncin interfaceCompletionStage<T>- Overrides:
acceptEitherAsyncin classCompletableFuture<T>
-
runAfterEither
- Specified by:
runAfterEitherin interfaceCompletionStage<T>- Overrides:
runAfterEitherin classCompletableFuture<T>
-
runAfterEitherAsync
- Specified by:
runAfterEitherAsyncin interfaceCompletionStage<T>- Overrides:
runAfterEitherAsyncin classCompletableFuture<T>
-
runAfterEitherAsync
public CompletableFuture<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor) - Specified by:
runAfterEitherAsyncin interfaceCompletionStage<T>- Overrides:
runAfterEitherAsyncin classCompletableFuture<T>
-
thenCompose
- Specified by:
thenComposein interfaceCompletionStage<T>- Overrides:
thenComposein classCompletableFuture<T>
-
thenComposeAsync
public <U> CompletableFuture<U> thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn) - Specified by:
thenComposeAsyncin interfaceCompletionStage<T>- Overrides:
thenComposeAsyncin classCompletableFuture<T>
-
thenComposeAsync
public <U> CompletableFuture<U> thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn, Executor executor) - Specified by:
thenComposeAsyncin interfaceCompletionStage<T>- Overrides:
thenComposeAsyncin classCompletableFuture<T>
-
whenComplete
- Specified by:
whenCompletein interfaceCompletionStage<T>- Overrides:
whenCompletein classCompletableFuture<T>
-
whenCompleteAsync
- Specified by:
whenCompleteAsyncin interfaceCompletionStage<T>- Overrides:
whenCompleteAsyncin classCompletableFuture<T>
-
whenCompleteAsync
public CompletableFuture<T> whenCompleteAsync(BiConsumer<? super T, ? super Throwable> action, Executor executor) - Specified by:
whenCompleteAsyncin interfaceCompletionStage<T>- Overrides:
whenCompleteAsyncin classCompletableFuture<T>
-
toString
- Overrides:
toStringin classCompletableFuture<T>
-
hashCode
public int hashCode() -
equals
-