Package com.terracottatech.store.async
Interface Operation<T>
- Type Parameters:
T- the type of the operation result
- All Superinterfaces:
CompletionStage<T>,Future<T>
A representation of the asynchronous execution of an operation. Asynchronous
dataset operations can be incorporated as stages of a larger computation
through use of the
CompletionStage methods.-
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) default <U> Operation<U>applyToEither(CompletionStage<? extends T> other, Function<? super T, U> fn) default <U> Operation<U>applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn) default <U> Operation<U>applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn, Executor executor) exceptionally(Function<Throwable, ? extends T> fn) default Executorexecutor()Returns the default asynchronous execution pool for this operation.default <U> Operation<U>handle(BiFunction<? super T, Throwable, ? extends U> fn) default <U> Operation<U>handleAsync(BiFunction<? super T, Throwable, ? extends U> fn) default <U> Operation<U>handleAsync(BiFunction<? super T, Throwable, ? extends U> fn, Executor executor) <U> Operation<U>Returns a new Operation that represents the synchronous mapping of this stages result using the provided function.static <T> Operation<T>operation(CompletableFuture<T> future) Create an operation who's completion is tied to the givenCompletableFuture.static <T> Operation<T>operation(CompletableFuture<T> future, Executor executor) /** Create an operation who's completion is tied to the givenCompletableFuture.static <T> Operation<T>Create an operation who's completion is tied to the givenFuture.static <T> Operation<T>Create an operation who's completion is tied to the givenFuture.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) thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action, Executor executor) default <U> Operation<U>default <U> Operation<U>thenApplyAsync(Function<? super T, ? extends U> fn) default <U> Operation<U>thenApplyAsync(Function<? super T, ? extends U> fn, Executor executor) default <U,V> Operation<V> thenCombine(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) default <U,V> Operation<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) default <U,V> Operation<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) default <U> Operation<U>thenCompose(Function<? super T, ? extends CompletionStage<U>> fn) default <U> Operation<U>thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn) default <U> Operation<U>thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn, Executor executor) thenRunAsync(Runnable action) thenRunAsync(Runnable action, Executor executor) default CompletableFuture<T>toCompletableFuture(Executor executor) Returns aCompletableFuturemaintaining the same completion properties as this stage using the supplied executor for any necessary synchronous calls.usingExecutor(Executor executor) Returns a new Operation that uses the supplied executor as it's default async executor.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 interface java.util.concurrent.CompletionStage
exceptionallyAsync, exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync, exceptionallyComposeAsync
-
Method Details
-
handleAsync
default <U> Operation<U> handleAsync(BiFunction<? super T, Throwable, ? extends U> fn, Executor executor) - Specified by:
handleAsyncin interfaceCompletionStage<T>
-
handleAsync
- Specified by:
handleAsyncin interfaceCompletionStage<T>
-
handle
- Specified by:
handlein interfaceCompletionStage<T>
-
whenCompleteAsync
default Operation<T> whenCompleteAsync(BiConsumer<? super T, ? super Throwable> action, Executor executor) - Specified by:
whenCompleteAsyncin interfaceCompletionStage<T>
-
whenCompleteAsync
- Specified by:
whenCompleteAsyncin interfaceCompletionStage<T>
-
whenComplete
- Specified by:
whenCompletein interfaceCompletionStage<T>
-
exceptionally
- Specified by:
exceptionallyin interfaceCompletionStage<T>
-
thenComposeAsync
default <U> Operation<U> thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn, Executor executor) - Specified by:
thenComposeAsyncin interfaceCompletionStage<T>
-
thenComposeAsync
- Specified by:
thenComposeAsyncin interfaceCompletionStage<T>
-
thenCompose
- Specified by:
thenComposein interfaceCompletionStage<T>
-
runAfterEitherAsync
default Operation<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor) - Specified by:
runAfterEitherAsyncin interfaceCompletionStage<T>
-
runAfterEitherAsync
- Specified by:
runAfterEitherAsyncin interfaceCompletionStage<T>
-
runAfterEither
- Specified by:
runAfterEitherin interfaceCompletionStage<T>
-
acceptEitherAsync
default Operation<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) - Specified by:
acceptEitherAsyncin interfaceCompletionStage<T>
-
acceptEitherAsync
default Operation<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action) - Specified by:
acceptEitherAsyncin interfaceCompletionStage<T>
-
acceptEither
default Operation<Void> acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action) - Specified by:
acceptEitherin interfaceCompletionStage<T>
-
applyToEitherAsync
default <U> Operation<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn, Executor executor) - Specified by:
applyToEitherAsyncin interfaceCompletionStage<T>
-
applyToEitherAsync
default <U> Operation<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn) - Specified by:
applyToEitherAsyncin interfaceCompletionStage<T>
-
applyToEither
default <U> Operation<U> applyToEither(CompletionStage<? extends T> other, Function<? super T, U> fn) - Specified by:
applyToEitherin interfaceCompletionStage<T>
-
runAfterBothAsync
default Operation<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor) - Specified by:
runAfterBothAsyncin interfaceCompletionStage<T>
-
runAfterBothAsync
- Specified by:
runAfterBothAsyncin interfaceCompletionStage<T>
-
runAfterBoth
- Specified by:
runAfterBothin interfaceCompletionStage<T>
-
thenAcceptBothAsync
default <U> Operation<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action, Executor executor) - Specified by:
thenAcceptBothAsyncin interfaceCompletionStage<T>
-
thenAcceptBothAsync
default <U> Operation<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) - Specified by:
thenAcceptBothAsyncin interfaceCompletionStage<T>
-
thenAcceptBoth
default <U> Operation<Void> thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) - Specified by:
thenAcceptBothin interfaceCompletionStage<T>
-
thenCombineAsync
default <U,V> Operation<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) - Specified by:
thenCombineAsyncin interfaceCompletionStage<T>
-
thenCombineAsync
default <U,V> Operation<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) - Specified by:
thenCombineAsyncin interfaceCompletionStage<T>
-
thenCombine
default <U,V> Operation<V> thenCombine(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) - Specified by:
thenCombinein interfaceCompletionStage<T>
-
thenRunAsync
- Specified by:
thenRunAsyncin interfaceCompletionStage<T>
-
thenRunAsync
- Specified by:
thenRunAsyncin interfaceCompletionStage<T>
-
thenRun
- Specified by:
thenRunin interfaceCompletionStage<T>
-
thenAcceptAsync
- Specified by:
thenAcceptAsyncin interfaceCompletionStage<T>
-
thenAcceptAsync
- Specified by:
thenAcceptAsyncin interfaceCompletionStage<T>
-
thenAccept
- Specified by:
thenAcceptin interfaceCompletionStage<T>
-
thenApplyAsync
- Specified by:
thenApplyAsyncin interfaceCompletionStage<T>
-
thenApplyAsync
- Specified by:
thenApplyAsyncin interfaceCompletionStage<T>
-
thenApply
- Specified by:
thenApplyin interfaceCompletionStage<T>
-
map
Returns a new Operation that represents the synchronous mapping of this stages result using the provided function.- Type Parameters:
U- the function's return type- Parameters:
fn- the mapping function- Returns:
- a new Operation
-
usingExecutor
Returns a new Operation that uses the supplied executor as it's default async executor.- Parameters:
executor- async executor- Returns:
- a new Operation
-
executor
Returns the default asynchronous execution pool for this operation.- Returns:
- the default asynchronous execution pool
-
toCompletableFuture
- Specified by:
toCompletableFuturein interfaceCompletionStage<T>
-
toCompletableFuture
Returns aCompletableFuturemaintaining the same completion properties as this stage using the supplied executor for any necessary synchronous calls.- Parameters:
executor- executor for sync calls- Returns:
- the CompletableFuture
-
operation
Create an operation who's completion is tied to the givenCompletableFuture.Default async execution mode operations against the returned operation will use the invoking pool (if there is one) or the
ForkJoinPool.commonPool()to poll the future when necessary.- Type Parameters:
T- the operations result type- Parameters:
future- underlying completable future- Returns:
- a new operation
-
operation
/** Create an operation who's completion is tied to the givenCompletableFuture.Default async execution mode operations against the returned operation will use the supplied executor.
- Type Parameters:
T- the operations result type- Parameters:
future- underlying completable futureexecutor- default async executor- Returns:
- a new operation
-
operation
Create an operation who's completion is tied to the givenFuture.Default async execution mode operations against the returned operation will use the invoking pool (if there is one) or the
ForkJoinPool.commonPool()to poll the future when necessary.- Type Parameters:
T- the operations result type- Parameters:
future- underlying future- Returns:
- a new operation
-
operation
Create an operation who's completion is tied to the givenFuture.Default async execution mode operations against the returned operation will use the supplied executor.
- Type Parameters:
T- the operations result type- Parameters:
future- underlying futureexecutor- default async executor- Returns:
- a new operation
-