- All Superinterfaces:
RuntimeType.Api<io.helidon.faulttolerance.AsyncConfig>
Runs synchronous suppliers asynchronously using virtual threads. Includes
convenient static method to avoid creating instances of this class.
-
Method Summary
Modifier and TypeMethodDescriptionstatic io.helidon.faulttolerance.AsyncConfig.Builderbuilder()Create a new fluent API builder for async.static Asynccreate()Async with default executor service.static Asynccreate(io.helidon.faulttolerance.AsyncConfig config) Async with explicit configuration.static AsyncCreate a new Async customizing its configuration.<T> CompletableFuture<T> Invoke a synchronous operation asynchronously.static <T> CompletableFuture<T> invokeStatic(Supplier<T> supplier) Convenience method to avoid having to callcreate().static <T> CompletableFuture<T> invokeStatic(Supplier<T> supplier, CompletableFuture<Async> onStart) Convenience method to avoid having to callcreate().Methods inherited from interface io.helidon.builder.api.RuntimeType.Api
prototype
-
Method Details
-
create
Async with default executor service.- Returns:
- a default async instance
-
create
Async with explicit configuration.- Parameters:
config- async configuration- Returns:
- a default async instance
-
create
Create a new Async customizing its configuration.- Parameters:
builderConsumer- consumer of async configuration- Returns:
- a new async
-
builder
static io.helidon.faulttolerance.AsyncConfig.Builder builder()Create a new fluent API builder for async.- Returns:
- a new builder
-
invokeStatic
Convenience method to avoid having to callcreate().- Type Parameters:
T- type of returned value- Parameters:
supplier- supplier of value (or a method reference)- Returns:
- a Single that is a "promise" of the future result
-
invokeStatic
static <T> CompletableFuture<T> invokeStatic(Supplier<T> supplier, CompletableFuture<Async> onStart) Convenience method to avoid having to callcreate(). Also accepts anonStartfuture to inform of async task startup.- Type Parameters:
T- type of returned value- Parameters:
supplier- supplier of value (or a method reference)onStart- future completed when async task starts- Returns:
- a future that is a "promise" of the future result
-
invoke
Invoke a synchronous operation asynchronously. This method never throws an exception. Any exception is returned via theCompletableFutureresult.- Type Parameters:
T- type of returned value- Parameters:
supplier- supplier of value (or a method reference)- Returns:
- a Single that is a "promise" of the future result
-