Package herddb.utils
Class Futures
- java.lang.Object
-
- herddb.utils.Futures
-
public class Futures extends Object
-
-
Constructor Summary
Constructors Constructor Description Futures()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> CompletableFuture<List<T>>collect(List<CompletableFuture<T>> futureList)static <T> CompletableFuture<T>exception(Throwable cause)static <T> TgetIfSuccess(CompletableFuture<T> future)static <T,ExceptionT extends Throwable>
Tresult(CompletableFuture<T> future)static <T,ExceptionT extends Throwable>
Tresult(CompletableFuture<T> future, long timeout, TimeUnit timeUnit)static <T,ExceptionT extends Throwable>
Tresult(CompletableFuture<T> future, Function<Throwable,ExceptionT> exceptionHandler)static <T,ExceptionT extends Throwable>
Tresult(CompletableFuture<T> future, Function<Throwable,ExceptionT> exceptionHandler, long timeout, TimeUnit timeUnit)
-
-
-
Method Detail
-
exception
public static <T> CompletableFuture<T> exception(Throwable cause)
-
collect
public static <T> CompletableFuture<List<T>> collect(List<CompletableFuture<T>> futureList)
-
result
public static <T,ExceptionT extends Throwable> T result(CompletableFuture<T> future, long timeout, TimeUnit timeUnit) throws ExceptionT extends Throwable, TimeoutException, InterruptedException, Exception
- Throws:
ExceptionT extends ThrowableTimeoutExceptionInterruptedExceptionException
-
result
public static <T,ExceptionT extends Throwable> T result(CompletableFuture<T> future) throws ExceptionT extends Throwable, TimeoutException, InterruptedException, Exception
- Throws:
ExceptionT extends ThrowableTimeoutExceptionInterruptedExceptionException
-
getIfSuccess
public static <T> T getIfSuccess(CompletableFuture<T> future)
-
result
public static <T,ExceptionT extends Throwable> T result(CompletableFuture<T> future, Function<Throwable,ExceptionT> exceptionHandler, long timeout, TimeUnit timeUnit) throws ExceptionT extends Throwable, TimeoutException, InterruptedException
- Throws:
ExceptionT extends ThrowableTimeoutExceptionInterruptedException
-
result
public static <T,ExceptionT extends Throwable> T result(CompletableFuture<T> future, Function<Throwable,ExceptionT> exceptionHandler) throws ExceptionT extends Throwable, InterruptedException
- Throws:
ExceptionT extends ThrowableInterruptedException
-
-