Async Class

  • java.lang.Object
    • com.microsoft.bot.connector.Async

public final class Async

Asyc and CompletableFuture helpers methods.

Method Summary

Modifier and Type Method and Description
static java.util.concurrent.CompletableFuture<T> <T>completeExceptionally(Throwable ex)

Constructs a CompletableFuture completed exceptionally.

static java.util.concurrent.CompletableFuture<T> <T>tryCompletable(ThrowSupplier<CompletableFuture<T>> supplier)

Executes a block that returns a CompletableFuture, and catches any exceptions in order to properly return a completed exceptionally result.

static java.util.concurrent.CompletableFuture<T> <T>wrapBlock(ThrowSupplier<T> supplier)

Executes a block and returns a CompletableFuture with either the return value or the exception (completeExceptionally).

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Method Details

<T>completeExceptionally

public static CompletableFuture completeExceptionally(Throwable ex)

Constructs a CompletableFuture completed exceptionally.

Parameters:

ex - The exception.

Returns:

A CompletableFuture with the exception.

<T>tryCompletable

public static CompletableFuture tryCompletable(ThrowSupplier> supplier)

Executes a block that returns a CompletableFuture, and catches any exceptions in order to properly return a completed exceptionally result.

Parameters:

supplier - The block to execute.

Returns:

The CompletableFuture

<T>wrapBlock

public static CompletableFuture wrapBlock(ThrowSupplier supplier)

Executes a block and returns a CompletableFuture with either the return value or the exception (completeExceptionally).

Parameters:

supplier - The block to execute.

Returns:

The CompletableFuture

Applies to