T - a type of the successfully resolved promise valuepublic interface DependentPromise<T> extends Promise<T>
Promise wrapper that may keep track origin of this promise and cancel them
along with this promise itself.
For example:
DependentPromise<?> p1 = DependentPromise.from(CallableTask.runAsync(this::someLongRunningMethod, myExecutor));
DependentPromise<?> p2 = p1.thenRunAsync(this::someOtherLongRunningTask, true);
...
p2.cancel(true);
In the example p2 is created with specifying p1 as origin (last argument is true).
Now when canceling p2 both p2 and p1 will be cancelled if not completed yet.
The class add overloads to all composition methods declared in CompletionStage and Promise interface.
The ones that accepts another CompletionStage as argument (named *Both* and
*Either* are overloaded with a set of @{link PromiseOrigin as an argument to let
you specify what to enlist as origin: "this" related to the method call or the parameter.
Rest of methods from CompletionStage and Promise API are overloaded with boolean argument
enlistOrigin that specify whether or not the Promise object whose
method is invoked should be added as an origin to result.
All methods originally specified in CompletionStage does not add "this" as an origin to
resulting promise.
dependent, dependent, getNow, getNow, isCompletedExceptionally, join, raw, unwraptoCompletableFuturedefault <D> D as(Function<? super Promise<T>,D> decoratorFactory)
PromisePromise with a decorator specifieddefault <D> D asʹ(Function<? super DependentPromise<T>,D> decoratorFactory)
static <U> DependentPromise<U> from(Promise<U> source)
static <U> DependentPromise<U> from(Promise<U> source, Set<PromiseOrigin> defaultEnlistOptions)
DependentPromise<T> onCancel(Runnable action)
default DependentPromise<T> defaultAsyncOn(Executor executor)
defaultAsyncOn in interface Promise<T>default DependentPromise<T> delay(long timeout, TimeUnit unit)
default DependentPromise<T> delay(long timeout, TimeUnit unit, boolean delayOnError)
default DependentPromise<T> delay(Duration duration)
default DependentPromise<T> delay(long timeout, TimeUnit unit, boolean delayOnError, boolean enlistOrigin)
DependentPromise<T> delay(Duration duration, boolean delayOnError)
DependentPromise<T> delay(Duration duration, boolean delayOnError, boolean enlistOrigin)
default DependentPromise<T> orTimeout(long timeout, TimeUnit unit)
default DependentPromise<T> orTimeout(long timeout, TimeUnit unit, boolean cancelOnTimeout)
default DependentPromise<T> orTimeout(long timeout, TimeUnit unit, boolean cancelOnTimeout, boolean enlistOrigin)
default DependentPromise<T> orTimeout(Duration duration)
DependentPromise<T> orTimeout(Duration duration, boolean cancelOnTimeout)
DependentPromise<T> orTimeout(Duration duration, boolean cancelOnTimeout, boolean enlistOrigin)
default DependentPromise<T> onTimeout(T value, long timeout, TimeUnit unit)
default DependentPromise<T> onTimeout(T value, long timeout, TimeUnit unit, boolean cancelOnTimeout)
default DependentPromise<T> onTimeout(T value, long timeout, TimeUnit unit, boolean cancelOnTimeout, boolean enlistOrigin)
default DependentPromise<T> onTimeout(T value, Duration duration)
DependentPromise<T> onTimeout(T value, Duration duration, boolean cancelOnTimeout)
DependentPromise<T> onTimeout(T value, Duration duration, boolean cancelOnTimeout, boolean enlistOrigin)
default DependentPromise<T> onTimeout(Supplier<? extends T> supplier, long timeout, TimeUnit unit)
default DependentPromise<T> onTimeout(Supplier<? extends T> supplier, long timeout, TimeUnit unit, boolean cancelOnTimeout)
default DependentPromise<T> onTimeout(Supplier<? extends T> supplier, long timeout, TimeUnit unit, boolean cancelOnTimeout, boolean enlistOrigin)
default DependentPromise<T> onTimeout(Supplier<? extends T> supplier, Duration duration)
DependentPromise<T> onTimeout(Supplier<? extends T> supplier, Duration duration, boolean cancelOnTimeout)
DependentPromise<T> onTimeout(Supplier<? extends T> supplier, Duration duration, boolean cancelOnTimeout, boolean enlistOrigin)
<U> DependentPromise<U> thenApply(Function<? super T,? extends U> fn, boolean enlistOrigin)
<U> DependentPromise<U> thenApplyAsync(Function<? super T,? extends U> fn, boolean enlistOrigin)
<U> DependentPromise<U> thenApplyAsync(Function<? super T,? extends U> fn, Executor executor, boolean enlistOrigin)
DependentPromise<Void> thenAccept(Consumer<? super T> action, boolean enlistOrigin)
DependentPromise<Void> thenAcceptAsync(Consumer<? super T> action, boolean enlistOrigin)
DependentPromise<Void> thenAcceptAsync(Consumer<? super T> action, Executor executor, boolean enlistOrigin)
DependentPromise<Void> thenRun(Runnable action, boolean enlistOrigin)
DependentPromise<Void> thenRunAsync(Runnable action, boolean enlistOrigin)
DependentPromise<Void> thenRunAsync(Runnable action, Executor executor, boolean enlistOrigin)
<U,V> DependentPromise<V> thenCombine(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn, Set<PromiseOrigin> enlistOptions)
<U,V> DependentPromise<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn, Set<PromiseOrigin> enlistOptions)
<U,V> DependentPromise<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn, Executor executor, Set<PromiseOrigin> enlistOptions)
<U> DependentPromise<Void> thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action, Set<PromiseOrigin> enlistOptions)
<U> DependentPromise<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action, Set<PromiseOrigin> enlistOptions)
<U> DependentPromise<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action, Executor executor, Set<PromiseOrigin> enlistOptions)
DependentPromise<Void> runAfterBoth(CompletionStage<?> other, Runnable action, Set<PromiseOrigin> enlistOptions)
DependentPromise<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action, Set<PromiseOrigin> enlistOptions)
DependentPromise<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor, Set<PromiseOrigin> enlistOptions)
<U> DependentPromise<U> applyToEither(CompletionStage<? extends T> other, Function<? super T,U> fn, Set<PromiseOrigin> enlistOptions)
<U> DependentPromise<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn, Set<PromiseOrigin> enlistOptions)
<U> DependentPromise<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn, Executor executor, Set<PromiseOrigin> enlistOptions)
DependentPromise<Void> acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action, Set<PromiseOrigin> enlistOptions)
DependentPromise<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Set<PromiseOrigin> enlistOptions)
DependentPromise<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor, Set<PromiseOrigin> enlistOptions)
DependentPromise<Void> runAfterEither(CompletionStage<?> other, Runnable action, Set<PromiseOrigin> enlistOptions)
DependentPromise<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action, Set<PromiseOrigin> enlistOptions)
DependentPromise<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor, Set<PromiseOrigin> enlistOptions)
<U> DependentPromise<U> thenCompose(Function<? super T,? extends CompletionStage<U>> fn, boolean enlistOrigin)
<U> DependentPromise<U> thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn, boolean enlistOrigin)
<U> DependentPromise<U> thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn, Executor executor, boolean enlistOrigin)
DependentPromise<T> exceptionally(Function<Throwable,? extends T> fn, boolean enlistOrigin)
DependentPromise<T> exceptionallyAsync(Function<Throwable,? extends T> fn, boolean enlistOrigin)
DependentPromise<T> exceptionallyAsync(Function<Throwable,? extends T> fn, Executor executor, boolean enlistOrigin)
DependentPromise<T> exceptionallyCompose(Function<Throwable,? extends CompletionStage<T>> fn, boolean enlistOrigin)
DependentPromise<T> exceptionallyComposeAsync(Function<Throwable,? extends CompletionStage<T>> fn, boolean enlistOrigin)
DependentPromise<T> exceptionallyComposeAsync(Function<Throwable,? extends CompletionStage<T>> fn, Executor executor, boolean enlistOrigin)
DependentPromise<T> thenFilter(Predicate<? super T> predicate, boolean enlistOrigin)
DependentPromise<T> thenFilter(Predicate<? super T> predicate, Function<? super T,Throwable> errorSupplier, boolean enlistOrigin)
DependentPromise<T> thenFilterAsync(Predicate<? super T> predicate, boolean enlistOrigin)
DependentPromise<T> thenFilterAsync(Predicate<? super T> predicate, Function<? super T,Throwable> errorSupplier, boolean enlistOrigin)
DependentPromise<T> thenFilterAsync(Predicate<? super T> predicate, Executor executor, boolean enlistOrigin)
DependentPromise<T> thenFilterAsync(Predicate<? super T> predicate, Function<? super T,Throwable> errorSupplier, Executor executor, boolean enlistOrigin)
DependentPromise<T> whenComplete(BiConsumer<? super T,? super Throwable> action, boolean enlistOrigin)
DependentPromise<T> whenCompleteAsync(BiConsumer<? super T,? super Throwable> action, boolean enlistOrigin)
DependentPromise<T> whenCompleteAsync(BiConsumer<? super T,? super Throwable> action, Executor executor, boolean enlistOrigin)
<U> DependentPromise<U> handle(BiFunction<? super T,Throwable,? extends U> fn, boolean enlistOrigin)
<U> DependentPromise<U> handleAsync(BiFunction<? super T,Throwable,? extends U> fn, boolean enlistOrigin)
<U> DependentPromise<U> handleAsync(BiFunction<? super T,Throwable,? extends U> fn, Executor executor, boolean enlistOrigin)
CompletableFuture<T> toCompletableFuture(boolean enlistOrigin)
<U> DependentPromise<U> thenApply(Function<? super T,? extends U> fn)
<U> DependentPromise<U> thenApplyAsync(Function<? super T,? extends U> fn)
thenApplyAsync in interface CompletionStage<T>thenApplyAsync in interface Promise<T><U> DependentPromise<U> thenApplyAsync(Function<? super T,? extends U> fn, Executor executor)
thenApplyAsync in interface CompletionStage<T>thenApplyAsync in interface Promise<T>DependentPromise<Void> thenAccept(Consumer<? super T> action)
thenAccept in interface CompletionStage<T>thenAccept in interface Promise<T>DependentPromise<Void> thenAcceptAsync(Consumer<? super T> action)
thenAcceptAsync in interface CompletionStage<T>thenAcceptAsync in interface Promise<T>DependentPromise<Void> thenAcceptAsync(Consumer<? super T> action, Executor executor)
thenAcceptAsync in interface CompletionStage<T>thenAcceptAsync in interface Promise<T>DependentPromise<Void> thenRun(Runnable action)
DependentPromise<Void> thenRunAsync(Runnable action)
thenRunAsync in interface CompletionStage<T>thenRunAsync in interface Promise<T>DependentPromise<Void> thenRunAsync(Runnable action, Executor executor)
thenRunAsync in interface CompletionStage<T>thenRunAsync in interface Promise<T><U,V> DependentPromise<V> thenCombine(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn)
thenCombine in interface CompletionStage<T>thenCombine in interface Promise<T><U,V> DependentPromise<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn)
thenCombineAsync in interface CompletionStage<T>thenCombineAsync in interface Promise<T><U,V> DependentPromise<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn, Executor executor)
thenCombineAsync in interface CompletionStage<T>thenCombineAsync in interface Promise<T><U> DependentPromise<Void> thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)
thenAcceptBoth in interface CompletionStage<T>thenAcceptBoth in interface Promise<T><U> DependentPromise<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)
thenAcceptBothAsync in interface CompletionStage<T>thenAcceptBothAsync in interface Promise<T><U> DependentPromise<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action, Executor executor)
thenAcceptBothAsync in interface CompletionStage<T>thenAcceptBothAsync in interface Promise<T>DependentPromise<Void> runAfterBoth(CompletionStage<?> other, Runnable action)
runAfterBoth in interface CompletionStage<T>runAfterBoth in interface Promise<T>DependentPromise<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action)
runAfterBothAsync in interface CompletionStage<T>runAfterBothAsync in interface Promise<T>DependentPromise<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor)
runAfterBothAsync in interface CompletionStage<T>runAfterBothAsync in interface Promise<T><U> DependentPromise<U> applyToEither(CompletionStage<? extends T> other, Function<? super T,U> fn)
applyToEither in interface CompletionStage<T>applyToEither in interface Promise<T><U> DependentPromise<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn)
applyToEitherAsync in interface CompletionStage<T>applyToEitherAsync in interface Promise<T><U> DependentPromise<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn, Executor executor)
applyToEitherAsync in interface CompletionStage<T>applyToEitherAsync in interface Promise<T>DependentPromise<Void> acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action)
acceptEither in interface CompletionStage<T>acceptEither in interface Promise<T>DependentPromise<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action)
acceptEitherAsync in interface CompletionStage<T>acceptEitherAsync in interface Promise<T>DependentPromise<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor)
acceptEitherAsync in interface CompletionStage<T>acceptEitherAsync in interface Promise<T>DependentPromise<Void> runAfterEither(CompletionStage<?> other, Runnable action)
runAfterEither in interface CompletionStage<T>runAfterEither in interface Promise<T>DependentPromise<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action)
runAfterEitherAsync in interface CompletionStage<T>runAfterEitherAsync in interface Promise<T>DependentPromise<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor)
runAfterEitherAsync in interface CompletionStage<T>runAfterEitherAsync in interface Promise<T><U> DependentPromise<U> thenCompose(Function<? super T,? extends CompletionStage<U>> fn)
thenCompose in interface CompletionStage<T>thenCompose in interface Promise<T><U> DependentPromise<U> thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn)
thenComposeAsync in interface CompletionStage<T>thenComposeAsync in interface Promise<T><U> DependentPromise<U> thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn, Executor executor)
thenComposeAsync in interface CompletionStage<T>thenComposeAsync in interface Promise<T>DependentPromise<T> exceptionally(Function<Throwable,? extends T> fn)
exceptionally in interface CompletionStage<T>exceptionally in interface Promise<T>DependentPromise<T> exceptionallyAsync(Function<Throwable,? extends T> fn)
exceptionallyAsync in interface Promise<T>DependentPromise<T> exceptionallyAsync(Function<Throwable,? extends T> fn, Executor executor)
exceptionallyAsync in interface Promise<T>DependentPromise<T> exceptionallyCompose(Function<Throwable,? extends CompletionStage<T>> fn)
exceptionallyCompose in interface Promise<T>DependentPromise<T> exceptionallyComposeAsync(Function<Throwable,? extends CompletionStage<T>> fn)
exceptionallyComposeAsync in interface Promise<T>DependentPromise<T> exceptionallyComposeAsync(Function<Throwable,? extends CompletionStage<T>> fn, Executor executor)
exceptionallyComposeAsync in interface Promise<T>DependentPromise<T> thenFilter(Predicate<? super T> predicate)
thenFilter in interface Promise<T>DependentPromise<T> thenFilter(Predicate<? super T> predicate, Function<? super T,Throwable> errorSupplier)
thenFilter in interface Promise<T>DependentPromise<T> thenFilterAsync(Predicate<? super T> predicate)
thenFilterAsync in interface Promise<T>DependentPromise<T> thenFilterAsync(Predicate<? super T> predicate, Function<? super T,Throwable> errorSupplier)
thenFilterAsync in interface Promise<T>DependentPromise<T> thenFilterAsync(Predicate<? super T> predicate, Executor executor)
thenFilterAsync in interface Promise<T>DependentPromise<T> thenFilterAsync(Predicate<? super T> predicate, Function<? super T,Throwable> errorSupplier, Executor executor)
thenFilterAsync in interface Promise<T>DependentPromise<T> whenComplete(BiConsumer<? super T,? super Throwable> action)
whenComplete in interface CompletionStage<T>whenComplete in interface Promise<T>DependentPromise<T> whenCompleteAsync(BiConsumer<? super T,? super Throwable> action)
whenCompleteAsync in interface CompletionStage<T>whenCompleteAsync in interface Promise<T>DependentPromise<T> whenCompleteAsync(BiConsumer<? super T,? super Throwable> action, Executor executor)
whenCompleteAsync in interface CompletionStage<T>whenCompleteAsync in interface Promise<T><U> DependentPromise<U> handle(BiFunction<? super T,Throwable,? extends U> fn)
<U> DependentPromise<U> handleAsync(BiFunction<? super T,Throwable,? extends U> fn)
handleAsync in interface CompletionStage<T>handleAsync in interface Promise<T><U> DependentPromise<U> handleAsync(BiFunction<? super T,Throwable,? extends U> fn, Executor executor)
handleAsync in interface CompletionStage<T>handleAsync in interface Promise<T>Copyright © 2021. All rights reserved.