- java.lang.Object
-
- eu.ess.xaos.core.util.DefaultExecutorCompletionStage<T>
-
- Type Parameters:
T
- The type passed to the consumers of thisCompletionStage
methods.
- All Implemented Interfaces:
CompletionStage<T>
public class DefaultExecutorCompletionStage<T> extends Object implements CompletionStage<T>
Completion stage wrapper that uses the provided executor as both the default execution facility and the default asynchronous execution facility. ACompletionStage
returned from any of this completion stage's methods inherits this stage's execution facilities. This means, for example, thatthis.thenApply(f).thenAcceptAsync(g).thenRun(h)
is equivalent tothis.thenApplyAsync(f, executor).thenAcceptAsync(g, executor).thenRunAsync(h, executor)
whereexecutor
is the executor this stage was created with.- Author:
- claudio.rosati@esss.se
- See Also:
- LiveDirsFX:org.fxmisc.livedirs.CompletionStageWithDefaultExecutor
-
-
Method Summary
-
-
-
Method Detail
-
wrap
public static <U> CompletionStage<U> wrap(CompletionStage<U> original, Executor defaultExecutor)
- Type Parameters:
U
- The type of theoriginal
CompletionStage
.- Parameters:
original
- TheCompletionStage
to be wrapped.defaultExecutor
- TheExecutor
to be used by the wrapper.- Returns:
- Instance of this class wrapping the given
original
CompletionStage
.
-
acceptEither
public CompletionStage<Void> acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action)
- Specified by:
acceptEither
in interfaceCompletionStage<T>
-
acceptEitherAsync
public CompletionStage<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action)
- Specified by:
acceptEitherAsync
in interfaceCompletionStage<T>
-
acceptEitherAsync
public CompletionStage<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor)
- Specified by:
acceptEitherAsync
in interfaceCompletionStage<T>
-
applyToEither
public <U> CompletionStage<U> applyToEither(CompletionStage<? extends T> other, Function<? super T,U> fn)
- Specified by:
applyToEither
in interfaceCompletionStage<T>
-
applyToEitherAsync
public <U> CompletionStage<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn)
- Specified by:
applyToEitherAsync
in interfaceCompletionStage<T>
-
applyToEitherAsync
public <U> CompletionStage<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn, Executor executor)
- Specified by:
applyToEitherAsync
in interfaceCompletionStage<T>
-
exceptionally
public CompletionStage<T> exceptionally(Function<Throwable,? extends T> fn)
- Specified by:
exceptionally
in interfaceCompletionStage<T>
-
handle
public <U> CompletionStage<U> handle(BiFunction<? super T,Throwable,? extends U> fn)
- Specified by:
handle
in interfaceCompletionStage<T>
-
handleAsync
public <U> CompletionStage<U> handleAsync(BiFunction<? super T,Throwable,? extends U> fn)
- Specified by:
handleAsync
in interfaceCompletionStage<T>
-
handleAsync
public <U> CompletionStage<U> handleAsync(BiFunction<? super T,Throwable,? extends U> fn, Executor executor)
- Specified by:
handleAsync
in interfaceCompletionStage<T>
-
runAfterBoth
public CompletionStage<Void> runAfterBoth(CompletionStage<?> other, Runnable action)
- Specified by:
runAfterBoth
in interfaceCompletionStage<T>
-
runAfterBothAsync
public CompletionStage<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action)
- Specified by:
runAfterBothAsync
in interfaceCompletionStage<T>
-
runAfterBothAsync
public CompletionStage<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor)
- Specified by:
runAfterBothAsync
in interfaceCompletionStage<T>
-
runAfterEither
public CompletionStage<Void> runAfterEither(CompletionStage<?> other, Runnable action)
- Specified by:
runAfterEither
in interfaceCompletionStage<T>
-
runAfterEitherAsync
public CompletionStage<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action)
- Specified by:
runAfterEitherAsync
in interfaceCompletionStage<T>
-
runAfterEitherAsync
public CompletionStage<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor)
- Specified by:
runAfterEitherAsync
in interfaceCompletionStage<T>
-
thenAccept
public CompletionStage<Void> thenAccept(Consumer<? super T> action)
- Specified by:
thenAccept
in interfaceCompletionStage<T>
-
thenAcceptAsync
public CompletionStage<Void> thenAcceptAsync(Consumer<? super T> action)
- Specified by:
thenAcceptAsync
in interfaceCompletionStage<T>
-
thenAcceptAsync
public CompletionStage<Void> thenAcceptAsync(Consumer<? super T> action, Executor executor)
- Specified by:
thenAcceptAsync
in interfaceCompletionStage<T>
-
thenAcceptBoth
public <U> CompletionStage<Void> thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)
- Specified by:
thenAcceptBoth
in interfaceCompletionStage<T>
-
thenAcceptBothAsync
public <U> CompletionStage<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action)
- Specified by:
thenAcceptBothAsync
in interfaceCompletionStage<T>
-
thenAcceptBothAsync
public <U> CompletionStage<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T,? super U> action, Executor executor)
- Specified by:
thenAcceptBothAsync
in interfaceCompletionStage<T>
-
thenApply
public <U> CompletionStage<U> thenApply(Function<? super T,? extends U> fn)
- Specified by:
thenApply
in interfaceCompletionStage<T>
-
thenApplyAsync
public <U> CompletionStage<U> thenApplyAsync(Function<? super T,? extends U> fn)
- Specified by:
thenApplyAsync
in interfaceCompletionStage<T>
-
thenApplyAsync
public <U> CompletionStage<U> thenApplyAsync(Function<? super T,? extends U> fn, Executor executor)
- Specified by:
thenApplyAsync
in interfaceCompletionStage<T>
-
thenCombine
public <U,V> CompletionStage<V> thenCombine(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn)
- Specified by:
thenCombine
in interfaceCompletionStage<T>
-
thenCombineAsync
public <U,V> CompletionStage<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn)
- Specified by:
thenCombineAsync
in interfaceCompletionStage<T>
-
thenCombineAsync
public <U,V> CompletionStage<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn, Executor executor)
- Specified by:
thenCombineAsync
in interfaceCompletionStage<T>
-
thenCompose
public <U> CompletionStage<U> thenCompose(Function<? super T,? extends CompletionStage<U>> fn)
- Specified by:
thenCompose
in interfaceCompletionStage<T>
-
thenComposeAsync
public <U> CompletionStage<U> thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn)
- Specified by:
thenComposeAsync
in interfaceCompletionStage<T>
-
thenComposeAsync
public <U> CompletionStage<U> thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn, Executor executor)
- Specified by:
thenComposeAsync
in interfaceCompletionStage<T>
-
thenRun
public CompletionStage<Void> thenRun(Runnable action)
- Specified by:
thenRun
in interfaceCompletionStage<T>
-
thenRunAsync
public CompletionStage<Void> thenRunAsync(Runnable action)
- Specified by:
thenRunAsync
in interfaceCompletionStage<T>
-
thenRunAsync
public CompletionStage<Void> thenRunAsync(Runnable action, Executor executor)
- Specified by:
thenRunAsync
in interfaceCompletionStage<T>
-
toCompletableFuture
public CompletableFuture<T> toCompletableFuture()
- Specified by:
toCompletableFuture
in interfaceCompletionStage<T>
-
whenComplete
public CompletionStage<T> whenComplete(BiConsumer<? super T,? super Throwable> action)
- Specified by:
whenComplete
in interfaceCompletionStage<T>
-
whenCompleteAsync
public CompletionStage<T> whenCompleteAsync(BiConsumer<? super T,? super Throwable> action)
- Specified by:
whenCompleteAsync
in interfaceCompletionStage<T>
-
whenCompleteAsync
public CompletionStage<T> whenCompleteAsync(BiConsumer<? super T,? super Throwable> action, Executor executor)
- Specified by:
whenCompleteAsync
in interfaceCompletionStage<T>
-
-