Package dev.webfx.platform.async
Class AsyncUtil
java.lang.Object
dev.webfx.platform.async.AsyncUtil
- Author:
- Bruno Salmon
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,
R> Future<R> consumeAsync
(Consumer<T> consumer, T arg) Wrap a consumer into a future that complete immediately or fail if an exception is thrown.static <R> Future<R>
Wrap a runnable into a future that complete immediately or fail if an exception is thrown.
-
Constructor Details
-
AsyncUtil
public AsyncUtil()
-
-
Method Details
-
runAsync
Wrap a runnable into a future that complete immediately or fail if an exception is thrown.- Parameters:
runnable
- the runnable- Returns:
- the future
-
consumeAsync
Wrap a consumer into a future that complete immediately or fail if an exception is thrown.- Type Parameters:
T
- the argument type- Parameters:
consumer
- the consumerarg
- the argument to pass to the consumer- Returns:
- the future
-
allOf
-