Share via


ICompletionStage.WhenCompleteAsync Method

Definition

Overloads

WhenCompleteAsync(IBiConsumer)

Returns a new CompletionStage with the same result or exception as this stage, that executes the given action using this stage's default asynchronous execution facility when this stage completes.

WhenCompleteAsync(IBiConsumer, IExecutor)

Returns a new CompletionStage with the same result or exception as this stage, that executes the given action using the supplied Executor when this stage completes.

WhenCompleteAsync(IBiConsumer)

Returns a new CompletionStage with the same result or exception as this stage, that executes the given action using this stage's default asynchronous execution facility when this stage completes.

[Android.Runtime.Register("whenCompleteAsync", "(Ljava/util/function/BiConsumer;)Ljava/util/concurrent/CompletionStage;", "GetWhenCompleteAsync_Ljava_util_function_BiConsumer_Handler:Java.Util.Concurrent.ICompletionStageInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=24)]
public Java.Util.Concurrent.ICompletionStage? WhenCompleteAsync (Java.Util.Functions.IBiConsumer? action);
[<Android.Runtime.Register("whenCompleteAsync", "(Ljava/util/function/BiConsumer;)Ljava/util/concurrent/CompletionStage;", "GetWhenCompleteAsync_Ljava_util_function_BiConsumer_Handler:Java.Util.Concurrent.ICompletionStageInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=24)>]
abstract member WhenCompleteAsync : Java.Util.Functions.IBiConsumer -> Java.Util.Concurrent.ICompletionStage

Parameters

action
IBiConsumer

the action to perform

Returns

the new CompletionStage

Attributes

Remarks

Returns a new CompletionStage with the same result or exception as this stage, that executes the given action using this stage's default asynchronous execution facility when this stage completes.

When this stage is complete, the given action is invoked with the result (or null if none) and the exception (or null if none) of this stage as arguments. The returned stage is completed when the action returns.

Unlike method #handleAsync(BiFunction) handleAsync, this method is not designed to translate completion outcomes, so the supplied action should not throw an exception. However, if it does, the following rules apply: If this stage completed normally but the supplied action throws an exception, then the returned stage completes exceptionally with the supplied action's exception. Or, if this stage completed exceptionally and the supplied action throws an exception, then the returned stage completes exceptionally with this stage's exception.

Java documentation for java.util.concurrent.CompletionStage.whenCompleteAsync(java.util.function.BiConsumer<? super T, ? super java.lang.Throwable>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

WhenCompleteAsync(IBiConsumer, IExecutor)

Returns a new CompletionStage with the same result or exception as this stage, that executes the given action using the supplied Executor when this stage completes.

[Android.Runtime.Register("whenCompleteAsync", "(Ljava/util/function/BiConsumer;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletionStage;", "GetWhenCompleteAsync_Ljava_util_function_BiConsumer_Ljava_util_concurrent_Executor_Handler:Java.Util.Concurrent.ICompletionStageInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=24)]
public Java.Util.Concurrent.ICompletionStage? WhenCompleteAsync (Java.Util.Functions.IBiConsumer? action, Java.Util.Concurrent.IExecutor? executor);
[<Android.Runtime.Register("whenCompleteAsync", "(Ljava/util/function/BiConsumer;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletionStage;", "GetWhenCompleteAsync_Ljava_util_function_BiConsumer_Ljava_util_concurrent_Executor_Handler:Java.Util.Concurrent.ICompletionStageInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=24)>]
abstract member WhenCompleteAsync : Java.Util.Functions.IBiConsumer * Java.Util.Concurrent.IExecutor -> Java.Util.Concurrent.ICompletionStage

Parameters

action
IBiConsumer

the action to perform

executor
IExecutor

the executor to use for asynchronous execution

Returns

the new CompletionStage

Attributes

Remarks

Returns a new CompletionStage with the same result or exception as this stage, that executes the given action using the supplied Executor when this stage completes.

When this stage is complete, the given action is invoked with the result (or null if none) and the exception (or null if none) of this stage as arguments. The returned stage is completed when the action returns.

Unlike method #handleAsync(BiFunction,Executor) handleAsync, this method is not designed to translate completion outcomes, so the supplied action should not throw an exception. However, if it does, the following rules apply: If this stage completed normally but the supplied action throws an exception, then the returned stage completes exceptionally with the supplied action's exception. Or, if this stage completed exceptionally and the supplied action throws an exception, then the returned stage completes exceptionally with this stage's exception.

Java documentation for java.util.concurrent.CompletionStage.whenCompleteAsync(java.util.function.BiConsumer<? super T, ? super java.lang.Throwable>, java.util.concurrent.Executor).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to