Language

CompletableFuture.ExceptionallyAsync Method

Definition

Overloads

Name Description
ExceptionallyAsync(IFunction)

Creates a dependent future that can recover from a failed completion with an asynchronously computed value.

ExceptionallyAsync(IFunction, IExecutor)

Creates a dependent future that can recover from a failed completion using the specified executor.

ExceptionallyAsync(IFunction)

Creates a dependent future that can recover from a failed completion with an asynchronously computed value.

[Android.Runtime.Register("exceptionallyAsync", "(Ljava/util/function/Function;)Ljava/util/concurrent/CompletableFuture;", "GetExceptionallyAsync_Ljava_util_function_Function_Handler", ApiSince=34)]
public virtual Java.Util.Concurrent.ICompletionStage? ExceptionallyAsync(Java.Util.Functions.IFunction? fn);
[<Android.Runtime.Register("exceptionallyAsync", "(Ljava/util/function/Function;)Ljava/util/concurrent/CompletableFuture;", "GetExceptionallyAsync_Ljava_util_function_Function_Handler", ApiSince=34)>]
abstract member ExceptionallyAsync : Java.Util.Functions.IFunction -> Java.Util.Concurrent.ICompletionStage
override this.ExceptionallyAsync : Java.Util.Functions.IFunction -> Java.Util.Concurrent.ICompletionStage

Parameters

fn
IFunction

The function that receives the failed completion's exception and computes a replacement value.

Returns

A dependent future that receives the original successful value or the value computed by fn.

Implements

Attributes

Remarks

The recovery function uses this future's default executor. It is not called when this future completes successfully. If the function throws, the dependent future completes exceptionally.

Applies to

ExceptionallyAsync(IFunction, IExecutor)

Creates a dependent future that can recover from a failed completion using the specified executor.

[Android.Runtime.Register("exceptionallyAsync", "(Ljava/util/function/Function;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;", "GetExceptionallyAsync_Ljava_util_function_Function_Ljava_util_concurrent_Executor_Handler", ApiSince=34)]
public virtual Java.Util.Concurrent.ICompletionStage? ExceptionallyAsync(Java.Util.Functions.IFunction? fn, Java.Util.Concurrent.IExecutor? executor);
[<Android.Runtime.Register("exceptionallyAsync", "(Ljava/util/function/Function;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;", "GetExceptionallyAsync_Ljava_util_function_Function_Ljava_util_concurrent_Executor_Handler", ApiSince=34)>]
abstract member ExceptionallyAsync : Java.Util.Functions.IFunction * Java.Util.Concurrent.IExecutor -> Java.Util.Concurrent.ICompletionStage
override this.ExceptionallyAsync : Java.Util.Functions.IFunction * Java.Util.Concurrent.IExecutor -> Java.Util.Concurrent.ICompletionStage

Parameters

fn
IFunction

The function that receives the failed completion's exception and computes a replacement value.

executor
IExecutor

The executor used to run the recovery function.

Returns

A dependent future that receives the original successful value or the value computed by fn.

Implements

Attributes

Remarks

The recovery function is not called when this future completes successfully. If the function throws, the dependent future completes exceptionally.

Applies to