public final class CFUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> CompletableFuture<Void> |
allOf(Collection<CompletableFuture<T>> futures) |
static <T> CompletableFuture<T> |
failAfter(Duration duration)
Generates a completable future which times out.
|
static <T> T |
getUninterruptibly(Future<T> future) |
static <T,A extends Throwable> |
getUninterruptibly(Future<T> future,
Class<A> throwableA) |
static <T,A extends Throwable,B extends Throwable> |
getUninterruptibly(Future<T> future,
Class<A> throwableA,
Class<B> throwableB) |
static <T,A extends Throwable,B extends Throwable,C extends Throwable> |
getUninterruptibly(Future<T> future,
Class<A> throwableA,
Class<B> throwableB,
Class<C> throwableC) |
static <T,A extends Throwable,B extends Throwable,C extends Throwable,D extends Throwable> |
getUninterruptibly(Future<T> future,
Class<A> throwableA,
Class<B> throwableB,
Class<C> throwableC,
Class<D> throwableD) |
static void |
runAfter(Duration duration,
Runnable toRun)
Schedules a runnable after a given time
|
static void |
unwrap(Throwable throwable)
Unwraps ExecutionException thrown from a CompletableFuture.
|
static <A extends Throwable> |
unwrap(Throwable throwable,
Class<A> throwableA)
Unwraps ExecutionException thrown from a CompletableFuture.
|
static <T> CompletableFuture<T> |
within(CompletableFuture<T> future,
Duration duration)
Takes a completable future, and ensures that it completes within a certain duration.
|
public static <T,A extends Throwable,B extends Throwable,C extends Throwable,D extends Throwable> T getUninterruptibly(Future<T> future, Class<A> throwableA, Class<B> throwableB, Class<C> throwableC, Class<D> throwableD) throws A extends Throwable, B extends Throwable, C extends Throwable, D extends Throwable
A extends Throwable
public static <T,A extends Throwable,B extends Throwable,C extends Throwable> T getUninterruptibly(Future<T> future, Class<A> throwableA, Class<B> throwableB, Class<C> throwableC) throws A extends Throwable, B extends Throwable, C extends Throwable
A extends Throwable
public static <T,A extends Throwable,B extends Throwable> T getUninterruptibly(Future<T> future, Class<A> throwableA, Class<B> throwableB) throws A extends Throwable, B extends Throwable
A extends Throwable
public static <T,A extends Throwable> T getUninterruptibly(Future<T> future, Class<A> throwableA) throws A extends Throwable
A extends Throwable
public static <T> T getUninterruptibly(Future<T> future)
public static <T> CompletableFuture<T> failAfter(Duration duration)
T
- Ignored, since the future will always timeout.duration
- The duration to timeout after.public static void runAfter(Duration duration, Runnable toRun)
duration
- The duration to timeout after.public static <T> CompletableFuture<T> within(CompletableFuture<T> future, Duration duration)
T
- The return type of the future.future
- The completable future that must be completed within duration.duration
- The duration the future must be completed in.public static <T> CompletableFuture<Void> allOf(Collection<CompletableFuture<T>> futures)
public static <A extends Throwable> void unwrap(Throwable throwable, Class<A> throwableA) throws A extends Throwable
A
- Class of checked exception.throwable
- Throwable to unwrap.throwableA
- Checked Exception to expose.A
- Throws checked exception.A extends Throwable
public static void unwrap(Throwable throwable)
throwable
- Throwable to unwrap.Copyright © 2019 CorfuDB. All rights reserved.