ICompletionStage.WhenComplete(IBiConsumer) Method

Definition

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

[Android.Runtime.Register("whenComplete", "(Ljava/util/function/BiConsumer;)Ljava/util/concurrent/CompletionStage;", "GetWhenComplete_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? WhenComplete (Java.Util.Functions.IBiConsumer? action);
[<Android.Runtime.Register("whenComplete", "(Ljava/util/function/BiConsumer;)Ljava/util/concurrent/CompletionStage;", "GetWhenComplete_Ljava_util_function_BiConsumer_Handler:Java.Util.Concurrent.ICompletionStageInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=24)>]
abstract member WhenComplete : 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 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 #handle handle, 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.whenComplete(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