Class FutureUtils
java.lang.Object
org.eclipse.milo.opcua.stack.core.util.FutureUtils
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> FutureUtils.CompletionBuilder<T>complete(CompletableFuture<T> future) Completefuturewith the result of theCompletableFuturethat is provided to the returnedFutureUtils.CompletionBuilder.static <T> FutureUtils.CompletionBuilder<T>completeAsync(CompletableFuture<T> future, Executor executor) Completefutureasynchronously with the result of theCompletableFuturethat is provided to the returnedFutureUtils.CompletionBuilder.static <T> CompletableFuture<T>Return aCompletableFuturethat has been completed exceptionally using the providedThrowable.static <T> CompletableFuture<T>failedUaFuture(long statusCode) Return aCompletableFuturethat has been completed exceptionally with aUaExceptionbuilt fromstatusCode.static <T> CompletableFuture<T>failedUaFuture(Throwable cause, long statusCode) Return aCompletableFuturethat has been completed exceptionally with aUaExceptionbuilt fromstatusCode.static <T> CompletableFuture<T>failedUaFuture(StatusCode statusCode) Return aCompletableFuturethat has been completed exceptionally with aUaExceptionbuilt fromstatusCode.static <T> CompletableFuture<List<T>>flatSequence(List<CompletableFuture<List<T>>> futures) Flatten a List of future Lists into a CompletableFuture of Liststatic <T> CompletableFuture<List<T>>sequence(CompletableFuture<T>... futures) static <T> CompletableFuture<List<T>>sequence(List<CompletableFuture<T>> futures) static <T> CompletableFuture<List<T>>sequence(Stream<CompletableFuture<T>> stream) static <T> CompletionStage<T>supplyAsyncCompose(Supplier<CompletionStage<T>> supplier, Executor executor) static <T> CompletableFuture<T>unwrap(CompletableFuture<CompletableFuture<T>> future) Unwrap a CompletableFuture of CompletableFuture ofTinto a CompletableFuture ofT.
-
Constructor Details
-
FutureUtils
public FutureUtils()
-
-
Method Details
-
supplyAsyncCompose
public static <T> CompletionStage<T> supplyAsyncCompose(Supplier<CompletionStage<T>> supplier, Executor executor) -
sequence
-
sequence
-
sequence
-
failedFuture
Return aCompletableFuturethat has been completed exceptionally using the providedThrowable.- Parameters:
ex- theThrowableto complete with.- Returns:
- a
CompletableFuturethat has been completed exceptionally using the providedThrowable.
-
failedUaFuture
Return aCompletableFuturethat has been completed exceptionally with aUaExceptionbuilt fromstatusCode.- Parameters:
statusCode- the status code to build theUaExceptionwith.- Returns:
- a
CompletableFuturethat has been completed exceptionally with aUaExceptionbuilt fromstatusCode.
-
failedUaFuture
Return aCompletableFuturethat has been completed exceptionally with aUaExceptionbuilt fromstatusCode.- Parameters:
statusCode- theStatusCodeto build theUaExceptionwith.- Returns:
- a
CompletableFuturethat has been completed exceptionally with aUaExceptionbuilt fromstatusCode.
-
failedUaFuture
Return aCompletableFuturethat has been completed exceptionally with aUaExceptionbuilt fromstatusCode.- Parameters:
cause- the innerException.statusCode- the status code to build theUaExceptionwith.- Returns:
- a
CompletableFuturethat has been completed exceptionally with aUaExceptionbuilt fromstatusCode.
-
complete
Completefuturewith the result of theCompletableFuturethat is provided to the returnedFutureUtils.CompletionBuilder.- Parameters:
future- the future to complete.- Returns:
- a
FutureUtils.CompletionBuilder.
-
completeAsync
public static <T> FutureUtils.CompletionBuilder<T> completeAsync(CompletableFuture<T> future, Executor executor) Completefutureasynchronously with the result of theCompletableFuturethat is provided to the returnedFutureUtils.CompletionBuilder.- Parameters:
future- the future to complete.executor- theExecutorto use.- Returns:
- a
FutureUtils.CompletionBuilder.
-
flatSequence
Flatten a List of future Lists into a CompletableFuture of List- Type Parameters:
T- the type of item the List holds- Parameters:
futures- a List of future Lists- Returns:
- a flattened CompletableFuture of List.
-
unwrap
Unwrap a CompletableFuture of CompletableFuture ofTinto a CompletableFuture ofT.- Parameters:
future- a CompletableFuture of CompletableFuture ofT.- Returns:
- an unwrapped CompletableFuture of
T.
-