AsyncOperation<T> Class
- java.
lang. Object - java.
util. concurrent. Future<T> - com.
microsoft. connecteddevices. AsyncOperation<T>
- com.
- java.
Type Parameters
- T
public class AsyncOperation
An operation that has a future result of type T or a possible exception. This class is a slightly simplified version of the android api level 24 CompletableFuture class
Implements the standard Future interface, and also provides basic continuation functionality. Please see CompletableFuture for detailed information on the how to use this class.
The important differences between CompletableFuture and AsyncOperation are as follows: 1. AsyncOperation's default asynchronous executor is Executors.newCachedThreadPool() whereas CompletableFuture uses ForkJoinPool.commonPool(). 2. AsyncOperation lacks obtrudeException and obtrudeValue methods.
Constructor Summary
Constructor | Description |
---|---|
AsyncOperation() |
Creates a new AsyncOperation |
Method Summary
Modifier and Type | Method and Description |
---|---|
<U> Async |
_handleAsyncInternal(AsyncOperation.ResultBiFunction<? super T, ? super Throwable, ? extends U> action, Executor executor)
The handle trio of functions (handle(action), handleAsync(action), and handleAsync(action,Executor)) are the most basic continuation functions upon which the others are built. Upon successful or exceptional completion of this operation, the passed in action will be executed allowing both antecedent results and antecedent exceptions to be observed. |
Async |
_whenCompleteAsyncInternal(AsyncOperation.ResultBiConsumer<? super T, ? super Throwable> action, Executor executor)
The whenComplete trio of functions (whenComplete(action), whenCompleteAsync(action), and whenCompleteAsync(action,Executor)) are similar to the handle functions. Upon successful or exceptional completion of this operation, the passed in action will be executed allowing both antecedent results and antecedent exceptions to be observed. Unlike handle, the results of the action do not propagate to dependent operations; they observe this stage's exception / result instead of the passed in action's |
Async |
acceptEither( @NonNull AsyncOperation<? extends T> other, @NonNull AsyncOperation.ResultConsumer<? super T> action)
The acceptEither trio of functions run a passed in ResultConsumer when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally. |
Async |
acceptEitherAsync( @NonNull AsyncOperation<? extends T> other, @NonNull AsyncOperation.ResultConsumer<? super T> action)
The acceptEither trio of functions run a passed in ResultConsumer when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally. |
Async |
acceptEitherAsync( @NonNull AsyncOperation<? extends T> other, AsyncOperation.ResultConsumer<? super T> action, @NonNull Executor executor)
The acceptEither trio of functions run a passed in ResultConsumer when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally. |
Async |
allOf(@NonNull AsyncOperation<?>... operations)
Creates an operation that will complete when all of the passed operations complete. |
Async |
anyOf(@NonNull AsyncOperation<?>... operations)
Creates an operation that will complete when any of the passed operations complete. |
<U> Async |
applyToEither( @NonNull AsyncOperation<? extends T> other, @NonNull AsyncOperation.ResultFunction<? super T, U> action)
The applyToEither trio of functions run a passed in ResultFunction when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally. |
<U> Async |
applyToEitherAsync( @NonNull AsyncOperation<? extends T> other, @NonNull AsyncOperation.ResultFunction<? super T, U> action)
The applyToEither trio of functions run a passed in ResultFunction when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally. |
<U> Async |
applyToEitherAsync(@NonNull AsyncOperation<? extends T> other, @NonNull AsyncOperation.ResultFunction<? super T, U> action, @NonNull Executor executor)
The applyToEither trio of functions run a passed in ResultFunction when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally. |
boolean |
cancel(boolean mayInterruptIfRunning)
Attempts to cancel the future and stop waiting for a result. Cancelling an AsyncOperation causes any threads waiting for the future via get() to immediately receive a CancellationException. The operation execution is not interrupted, but any eventual result from a cancelled call will be ignored. |
final void |
complete(T value)
Completes this operate with a given value. |
static<U> Async |
completedFuture(U value)
Creates an operation that is already completed with the given value |
final void |
completeExceptionally(@NonNull Throwable ex)
Sets the exception that will be thrown when the future value is retrieved, and marks the future done. |
Async |
exceptionally(@NonNull AsyncOperation.ResultFunction<Throwable, ? extends T> action)
Allows continuations to be attached that only run in the case of an exceptional completion of this operation. Note that there are no *async* variants of exceptionally so the action should not be long running as it may be blocking the thread that completed this operation or the calling thread ( in the case of an already completed operation). |
T |
get()
Gets the future value, waiting if necessary until the future is done. |
T |
get(long timeout, @NonNull TimeUnit unit)
Attempts to get the future value, waiting if necessary until the future is done or until a timeout. |
final T |
getNow(T valueIfAbsent)
Gets the value of the operation immediately returning a passed in value if the operation is not yet complete. |
int |
getNumberOfDependents()
Gets an estimated number of operations that are dependent on this operation. This is not intended to be used for synchronization / scheduling purposes. |
<U> Async |
handle(@NonNull AsyncOperation.ResultBiFunction<? super T, ? super Throwable, ? extends U> action)
The handle trio of functions (handle(action), handleAsync(action), and handleAsync(action,Executor)) are the most basic continuation functions upon which the others are built. Upon successful or exceptional completion of this operation, the passed in action will be executed allowing both antecedent results and antecedent exceptions to be observed. |
<U> Async |
handleAsync(@NonNull AsyncOperation.ResultBiFunction<? super T, ? super Throwable, ? extends U> action)
The handle trio of functions (handle(action), handleAsync(action), and handleAsync(action,Executor)) are the most basic continuation functions upon which the others are built. Upon successful or exceptional completion of this operation, the passed in action will be executed allowing both antecedent results and antecedent exceptions to be observed. |
<U> Async |
handleAsync( @NonNull AsyncOperation.ResultBiFunction<? super T, ? super Throwable, ? extends U> action, @NonNull Executor executor)
The handle trio of functions (handle(action), handleAsync(action), and handleAsync(action,Executor)) are the most basic continuation functions upon which the others are built. Upon successful or exceptional completion of this operation, the passed in action will be executed allowing both antecedent results and antecedent exceptions to be observed. |
boolean |
isCancelled()
Checks if the future has been successfully cancelled. |
boolean |
isCompletedExceptionally()
Checks if the operation completed in any exceptional way (cancellation or completeExceptionally) |
boolean |
isDone()
Checks if the future is done. The future is done when the result is set or an exception is set. |
T |
join()
Gets the future value, waiting if necessary until the future is done. Unlike get() join throws a CompletionException if any exception occured in the process of completing this operation |
Async |
runAfterBoth(@NonNull AsyncOperation<?> other, @NonNull Runnable action)
The runAfterBoth trio of functions run a passed in Runnable when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally. |
Async |
runAfterBothAsync(@NonNull AsyncOperation<?> other, @NonNull Runnable action)
The runAfterBoth trio of functions run a passed in Runnable when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally. |
Async |
runAfterBothAsync(@NonNull AsyncOperation<?> other, @NonNull Runnable action, @NonNull Executor executor)
The runAfterBoth trio of functions run a passed in Runnable when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally. |
Async |
runAfterEither(@NonNull AsyncOperation<?> other, @NonNull Runnable action)
The runAfterEither trio of functions run a passed in Runnable when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally. |
Async |
runAfterEitherAsync(@NonNull AsyncOperation<?> other, @NonNull Runnable action)
The runAfterEither trio of functions run a passed in Runnable when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally. |
Async |
runAfterEitherAsync( @NonNull AsyncOperation<?> other, @NonNull Runnable action, @NonNull Executor executor)
The runAfterEither trio of functions run a passed in Runnable when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally. |
Async |
runAsync(@NonNull Runnable runnable)
Creates an operation that will run the passed in Runnable on the default executor |
Async |
runAsync(@NonNull Runnable runnable, @NonNull Executor executor)
Creates an operation that will run the passed in Runnable on the passed in executor |
static<U> Async |
supplyAsync(@NonNull AsyncOperation.Supplier<U> supplier)
Creates an operation that will use the default executor to get a value from the supplier |
static<U> Async |
supplyAsync(@NonNull AsyncOperation.Supplier<U> supplier, @NonNull Executor executor)
Creates an operation that will use the passed in executor to get a value from the supplier |
Async |
thenAccept(@NonNull ResultConsumer<? super T> action)
The thenAccept trio of functions (thenAccept(action), thenAcceptAsync(action), and thenAcceptAsync(action,Executor)) run a passed in ResultConsumer when this operation completes successfully. |
Async |
thenAcceptAsync(@NonNull ResultConsumer<? super T> action)
The thenAccept trio of functions (thenAccept(action), thenAcceptAsync(action), and thenAcceptAsync(action,Executor)) run a passed in ResultConsumer when this operation completes successfully. |
Async |
thenAcceptAsync(@NonNull ResultConsumer<? super T> action, @NonNull Executor executor)
The thenAccept trio of functions (thenAccept(action), thenAcceptAsync(action), and thenAcceptAsync(action,Executor)) run a passed in ResultConsumer when this operation completes successfully. |
<U> Async |
thenAcceptBoth( @NonNull AsyncOperation<? extends U> other, @NonNull AsyncOperation.ResultBiConsumer<? super T, ? super U> action)
The thenAcceptBoth trio of functions run a passed in ResultConsumer when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally. |
<U> Async |
thenAcceptBothAsync( @NonNull AsyncOperation<? extends U> other, @NonNull AsyncOperation.ResultBiConsumer<? super T, ? super U> action)
The thenAcceptBoth trio of functions run a passed in ResultConsumer when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally. |
<U> Async |
thenAcceptBothAsync(@NonNull AsyncOperation<? extends U> other, @NonNull AsyncOperation.ResultBiConsumer<? super T, ? super U> action, @NonNull Executor executor)
The thenAcceptBoth trio of functions run a passed in ResultConsumer when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally. |
<U> Async |
thenApply(@NonNull ResultFunction<? super T, ? extends U> action)
The thenApply trio of functions (thenApplyAsync(action), thenApplyAsync(action), and thenApplyAsync(action,Executor)) run a passed in ResultFunction when this operation completes successfully. |
<U> Async |
thenApplyAsync(@NonNull ResultFunction<? super T, ? extends U> action)
The thenApply trio of functions (thenApplyAsync(action), thenApplyAsync(action), and thenApplyAsync(action,Executor)) run a passed in ResultFunction when this operation completes successfully. |
<U> Async |
thenApplyAsync(@NonNull ResultFunction<? super T, ? extends U> action, @NonNull Executor executor)
The thenApply trio of functions (thenApplyAsync(action), thenApplyAsync(action), and thenApplyAsync(action,Executor)) run a passed in ResultFunction when this operation completes successfully. |
<U, V> Async |
thenCombine( @NonNull AsyncOperation<? extends U> other, @NonNull AsyncOperation.ResultBiFunction<? super T, ? super U, ? extends V> action)
The thenCombine trio of functions run a passed in ResultFunction when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally. |
<U, V> Async |
thenCombineAsync( @NonNull AsyncOperation<? extends U> other, @NonNull AsyncOperation.ResultBiFunction<? super T, ? super U, ? extends V> action)
The thenCombine trio of functions run a passed in ResultFunction when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally. |
<U, V> Async |
thenCombineAsync(@NonNull AsyncOperation<? extends U> other, @NonNull AsyncOperation.ResultBiFunction<? super T, ? super U, ? extends V> action, @NonNull Executor executor)
The thenCombine trio of functions run a passed in ResultFunction when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally. |
<U> Async |
thenCompose(@NonNull AsyncOperation.ResultFunction<? super T, ? extends AsyncOperation<U>> action)
The thenCompose trio of functions run a passed in ResultFunction when this operation completes successfully. The ResultFunction returns an AsyncOperation<T> and the return operation from this call returns a AsyncOperation<T> as opposed to a AsyncOperation<AsyncOperation<T>> |
<U> Async |
thenComposeAsync(@NonNull AsyncOperation.ResultFunction<? super T, ? extends AsyncOperation<U>> action)
The thenCompose trio of functions run a passed in ResultFunction when this operation completes successfully. The ResultFunction returns an AsyncOperation<T> and the return operation from this call returns a AsyncOperation<T> as opposed to a AsyncOperation<AsyncOperation<T>> |
<U> Async |
thenComposeAsync(AsyncOperation.ResultFunction<? super T, ? extends AsyncOperation<U>> action, Executor executor)
The thenCompose trio of functions run a passed in ResultFunction when this operation completes successfully. The ResultFunction returns an AsyncOperation<T> and the return operation from this call returns a AsyncOperation<T> as opposed to a AsyncOperation<AsyncOperation<T>> |
Async |
thenRun(@NonNull Runnable action)
The thenRun trio of functions (thenRun(action), thenRunAsync(action), and thenRunAsync(action,Executor)) run a passed in Runnable when this operation completes successfully. |
Async |
thenRunAsync(@NonNull Runnable action)
The thenRun trio of functions (thenRun(action), thenRunAsync(action), and thenRunAsync(action,Executor)) run a passed in Runnable when this operation completes successfully. |
Async |
thenRunAsync(@NonNull Runnable action, @NonNull Executor executor)
The thenRun trio of functions (thenRun(action), thenRunAsync(action), and thenRunAsync(action,Executor)) run a passed in Runnable when this operation completes successfully. |
Async |
whenComplete(@NonNull AsyncOperation.ResultBiConsumer<? super T, ? super Throwable> action)
The whenComplete trio of functions (whenComplete(action), whenCompleteAsync(action), and whenCompleteAsync(action,Executor)) are similar to the handle functions. Upon successful or exceptional completion of this operation, the passed in action will be executed allowing both antecedent results and antecedent exceptions to be observed. Unlike handle, the results of the action do not propagate to dependent operations; they observe this stage's exception / result instead of the passed in action's |
Async |
whenCompleteAsync(@NonNull AsyncOperation.ResultBiConsumer<? super T, ? super Throwable> action)
The whenComplete trio of functions (whenComplete(action), whenCompleteAsync(action), and whenCompleteAsync(action,Executor)) are similar to the handle functions. Upon successful or exceptional completion of this operation, the passed in action will be executed allowing both antecedent results and antecedent exceptions to be observed. Unlike handle, the results of the action do not propagate to dependent operations; they observe this stage's exception / result instead of the passed in action's |
Async |
whenCompleteAsync( @NonNull AsyncOperation.ResultBiConsumer<? super T, ? super Throwable> action, @NonNull Executor executor)
The whenComplete trio of functions (whenComplete(action), whenCompleteAsync(action), and whenCompleteAsync(action,Executor)) are similar to the handle functions. Upon successful or exceptional completion of this operation, the passed in action will be executed allowing both antecedent results and antecedent exceptions to be observed. Unlike handle, the results of the action do not propagate to dependent operations; they observe this stage's exception / result instead of the passed in action's |
Constructor Details
AsyncOperation
public AsyncOperation()
Creates a new AsyncOperation
Method Details
_handleAsyncInternal
protected AsyncOperation _handleAsyncInternal(AsyncOperation.ResultBiFunction super T, ? super Throwable, ? extends U> action, Executor executor)
The handle trio of functions (handle(action), handleAsync(action), and handleAsync(action,Executor)) are the most basic continuation functions upon which the others are built. Upon successful or exceptional completion of this operation, the passed in action will be executed allowing both antecedent results and antecedent exceptions to be observed.
Parameters:
Returns:
_whenCompleteAsyncInternal
protected AsyncOperation
The whenComplete trio of functions (whenComplete(action), whenCompleteAsync(action), and whenCompleteAsync(action,Executor)) are similar to the handle functions. Upon successful or exceptional completion of this operation, the passed in action will be executed allowing both antecedent results and antecedent exceptions to be observed. Unlike handle, the results of the action do not propagate to dependent operations; they observe this stage's exception / result instead of the passed in action's
Parameters:
Returns:
acceptEither
public AsyncOperation
The acceptEither trio of functions run a passed in ResultConsumer when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
acceptEitherAsync
public AsyncOperation
The acceptEither trio of functions run a passed in ResultConsumer when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
acceptEitherAsync
public AsyncOperation
The acceptEither trio of functions run a passed in ResultConsumer when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
allOf
public static AsyncOperation
Creates an operation that will complete when all of the passed operations complete.
Parameters:
Returns:
anyOf
public static AsyncOperation
Creates an operation that will complete when any of the passed operations complete.
Parameters:
Returns:
applyToEither
public AsyncOperation applyToEither( @NonNull AsyncOperation extends T> other, @NonNull AsyncOperation.ResultFunction super T, U> action)
The applyToEither trio of functions run a passed in ResultFunction when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
applyToEitherAsync
public AsyncOperation applyToEitherAsync( @NonNull AsyncOperation extends T> other, @NonNull AsyncOperation.ResultFunction super T, U> action)
The applyToEither trio of functions run a passed in ResultFunction when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
applyToEitherAsync
public AsyncOperation applyToEitherAsync(@NonNull AsyncOperation extends T> other, @NonNull AsyncOperation.ResultFunction super T, U> action, @NonNull Executor executor)
The applyToEither trio of functions run a passed in ResultFunction when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
cancel
public boolean cancel(boolean mayInterruptIfRunning)
Attempts to cancel the future and stop waiting for a result.
Cancelling an AsyncOperation causes any threads waiting for the future via get() to immediately receive a CancellationException. The operation execution is not interrupted, but any eventual result from a cancelled call will be ignored.
Parameters:
Returns:
complete
public final void complete(T value)
Completes this operate with a given value.
Parameters:
completedFuture
public static static AsyncOperation completedFuture(U value)
Creates an operation that is already completed with the given value
Parameters:
Returns:
completeExceptionally
public final void completeExceptionally(@NonNull Throwable ex)
Sets the exception that will be thrown when the future value is retrieved, and marks the future done.
Parameters:
exceptionally
public AsyncOperation
Allows continuations to be attached that only run in the case of an exceptional completion of this operation. Note that there are no *async* variants of exceptionally so the action should not be long running as it may be blocking the thread that completed this operation or the calling thread ( in the case of an already completed operation).
Parameters:
get
public T get()
Gets the future value, waiting if necessary until the future is done.
Returns:
get
public T get(long timeout, @NonNull TimeUnit unit)
Attempts to get the future value, waiting if necessary until the future is done or until a timeout.
Parameters:
Returns:
getNow
public final T getNow(T valueIfAbsent)
Gets the value of the operation immediately returning a passed in value if the operation is not yet complete.
Parameters:
Returns:
getNumberOfDependents
public int getNumberOfDependents()
Gets an estimated number of operations that are dependent on this operation. This is not intended to be used for synchronization / scheduling purposes.
Returns:
handle
public AsyncOperation handle(@NonNull AsyncOperation.ResultBiFunction super T, ? super Throwable, ? extends U> action)
The handle trio of functions (handle(action), handleAsync(action), and handleAsync(action,Executor)) are the most basic continuation functions upon which the others are built. Upon successful or exceptional completion of this operation, the passed in action will be executed allowing both antecedent results and antecedent exceptions to be observed.
Parameters:
Returns:
handleAsync
public AsyncOperation handleAsync(@NonNull AsyncOperation.ResultBiFunction super T, ? super Throwable, ? extends U> action)
The handle trio of functions (handle(action), handleAsync(action), and handleAsync(action,Executor)) are the most basic continuation functions upon which the others are built. Upon successful or exceptional completion of this operation, the passed in action will be executed allowing both antecedent results and antecedent exceptions to be observed.
Parameters:
Returns:
handleAsync
public AsyncOperation handleAsync( @NonNull AsyncOperation.ResultBiFunction super T, ? super Throwable, ? extends U> action, @NonNull Executor executor)
The handle trio of functions (handle(action), handleAsync(action), and handleAsync(action,Executor)) are the most basic continuation functions upon which the others are built. Upon successful or exceptional completion of this operation, the passed in action will be executed allowing both antecedent results and antecedent exceptions to be observed.
Parameters:
Returns:
isCancelled
public boolean isCancelled()
Checks if the future has been successfully cancelled.
Returns:
isCompletedExceptionally
public boolean isCompletedExceptionally()
Checks if the operation completed in any exceptional way (cancellation or completeExceptionally)
Returns:
isDone
public boolean isDone()
Checks if the future is done. The future is done when the result is set or an exception is set.
Returns:
join
public T join()
Gets the future value, waiting if necessary until the future is done. Unlike get() join throws a CompletionException if any exception occured in the process of completing this operation
Returns:
runAfterBoth
public AsyncOperation
The runAfterBoth trio of functions run a passed in Runnable when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
runAfterBothAsync
public AsyncOperation
The runAfterBoth trio of functions run a passed in Runnable when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
runAfterBothAsync
public AsyncOperation
The runAfterBoth trio of functions run a passed in Runnable when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
runAfterEither
public AsyncOperation
The runAfterEither trio of functions run a passed in Runnable when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
runAfterEitherAsync
public AsyncOperation
The runAfterEither trio of functions run a passed in Runnable when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
runAfterEitherAsync
public AsyncOperation
The runAfterEither trio of functions run a passed in Runnable when either this operation or the passed in operation completes successfully. If the operation that completes does so exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
runAsync
public static AsyncOperation
Creates an operation that will run the passed in Runnable on the default executor
Parameters:
Returns:
runAsync
public static AsyncOperation
Creates an operation that will run the passed in Runnable on the passed in executor
Parameters:
Returns:
supplyAsync
public static static AsyncOperation supplyAsync(@NonNull AsyncOperation.Supplier supplier)
Creates an operation that will use the default executor to get a value from the supplier
Parameters:
Returns:
supplyAsync
public static static AsyncOperation supplyAsync(@NonNull AsyncOperation.Supplier supplier, @NonNull Executor executor)
Creates an operation that will use the passed in executor to get a value from the supplier
Parameters:
Returns:
thenAccept
public AsyncOperation
The thenAccept trio of functions (thenAccept(action), thenAcceptAsync(action), and thenAcceptAsync(action,Executor)) run a passed in ResultConsumer when this operation completes successfully.
Parameters:
Returns:
thenAcceptAsync
public AsyncOperation
The thenAccept trio of functions (thenAccept(action), thenAcceptAsync(action), and thenAcceptAsync(action,Executor)) run a passed in ResultConsumer when this operation completes successfully.
Parameters:
Returns:
thenAcceptAsync
public AsyncOperation
The thenAccept trio of functions (thenAccept(action), thenAcceptAsync(action), and thenAcceptAsync(action,Executor)) run a passed in ResultConsumer when this operation completes successfully.
Parameters:
Returns:
thenAcceptBoth
public AsyncOperation
The thenAcceptBoth trio of functions run a passed in ResultConsumer when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
thenAcceptBothAsync
public AsyncOperation
The thenAcceptBoth trio of functions run a passed in ResultConsumer when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
thenAcceptBothAsync
public AsyncOperation
The thenAcceptBoth trio of functions run a passed in ResultConsumer when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
thenApply
public AsyncOperation thenApply(@NonNull ResultFunction super T, ? extends U> action)
The thenApply trio of functions (thenApplyAsync(action), thenApplyAsync(action), and thenApplyAsync(action,Executor)) run a passed in ResultFunction when this operation completes successfully.
Parameters:
Returns:
thenApplyAsync
public AsyncOperation thenApplyAsync(@NonNull ResultFunction super T, ? extends U> action)
The thenApply trio of functions (thenApplyAsync(action), thenApplyAsync(action), and thenApplyAsync(action,Executor)) run a passed in ResultFunction when this operation completes successfully.
Parameters:
Returns:
thenApplyAsync
public AsyncOperation thenApplyAsync(@NonNull ResultFunction super T, ? extends U> action, @NonNull Executor executor)
The thenApply trio of functions (thenApplyAsync(action), thenApplyAsync(action), and thenApplyAsync(action,Executor)) run a passed in ResultFunction when this operation completes successfully.
Parameters:
Returns:
thenCombine
public AsyncOperation
The thenCombine trio of functions run a passed in ResultFunction when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
thenCombineAsync
public AsyncOperation
The thenCombine trio of functions run a passed in ResultFunction when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
thenCombineAsync
public AsyncOperation
The thenCombine trio of functions run a passed in ResultFunction when this operation and the passed in operation completes successfully. If either operation completes exceptionally, the returned operation also completes exceptionally.
Parameters:
Returns:
thenCompose
public AsyncOperation thenCompose(@NonNull AsyncOperation.ResultFunction super T, ? extends AsyncOperation> action)
The thenCompose trio of functions run a passed in ResultFunction when this operation completes successfully. The ResultFunction returns an AsyncOperation<T> and the return operation from this call returns a AsyncOperation<T> as opposed to a AsyncOperation<AsyncOperation<T>>
Parameters:
Returns:
thenComposeAsync
public AsyncOperation thenComposeAsync(@NonNull AsyncOperation.ResultFunction super T, ? extends AsyncOperation> action)
The thenCompose trio of functions run a passed in ResultFunction when this operation completes successfully. The ResultFunction returns an AsyncOperation<T> and the return operation from this call returns a AsyncOperation<T> as opposed to a AsyncOperation<AsyncOperation<T>>
Parameters:
Returns:
thenComposeAsync
public AsyncOperation thenComposeAsync(AsyncOperation.ResultFunction super T, ? extends AsyncOperation> action, Executor executor)
The thenCompose trio of functions run a passed in ResultFunction when this operation completes successfully. The ResultFunction returns an AsyncOperation<T> and the return operation from this call returns a AsyncOperation<T> as opposed to a AsyncOperation<AsyncOperation<T>>
Parameters:
Returns:
thenRun
public AsyncOperation
The thenRun trio of functions (thenRun(action), thenRunAsync(action), and thenRunAsync(action,Executor)) run a passed in Runnable when this operation completes successfully.
Parameters:
Returns:
thenRunAsync
public AsyncOperation
The thenRun trio of functions (thenRun(action), thenRunAsync(action), and thenRunAsync(action,Executor)) run a passed in Runnable when this operation completes successfully.
Parameters:
Returns:
thenRunAsync
public AsyncOperation
The thenRun trio of functions (thenRun(action), thenRunAsync(action), and thenRunAsync(action,Executor)) run a passed in Runnable when this operation completes successfully.
Parameters:
Returns:
whenComplete
public AsyncOperation
The whenComplete trio of functions (whenComplete(action), whenCompleteAsync(action), and whenCompleteAsync(action,Executor)) are similar to the handle functions. Upon successful or exceptional completion of this operation, the passed in action will be executed allowing both antecedent results and antecedent exceptions to be observed. Unlike handle, the results of the action do not propagate to dependent operations; they observe this stage's exception / result instead of the passed in action's
Parameters:
Returns:
whenCompleteAsync
public AsyncOperation
The whenComplete trio of functions (whenComplete(action), whenCompleteAsync(action), and whenCompleteAsync(action,Executor)) are similar to the handle functions. Upon successful or exceptional completion of this operation, the passed in action will be executed allowing both antecedent results and antecedent exceptions to be observed. Unlike handle, the results of the action do not propagate to dependent operations; they observe this stage's exception / result instead of the passed in action's
Parameters:
Returns:
whenCompleteAsync
public AsyncOperation
The whenComplete trio of functions (whenComplete(action), whenCompleteAsync(action), and whenCompleteAsync(action,Executor)) are similar to the handle functions. Upon successful or exceptional completion of this operation, the passed in action will be executed allowing both antecedent results and antecedent exceptions to be observed. Unlike handle, the results of the action do not propagate to dependent operations; they observe this stage's exception / result instead of the passed in action's
Parameters:
Returns: