Class FutureUtils
- java.lang.Object
-
- org.elasticsearch.common.util.concurrent.FutureUtils
-
public class FutureUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description FutureUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancancel(Future<?> toCancel)Cancel execution of this future without interrupting a running thread.static <T> Tget(Future<T> future)CallsFuture.get()without the checked exceptions.static <T> Tget(Future<T> future, long timeout, TimeUnit unit)CallsFuture.get(long, TimeUnit)without the checked exceptions.static RuntimeExceptionrethrowExecutionException(ExecutionException e)
-
-
-
Method Detail
-
cancel
public static boolean cancel(@Nullable Future<?> toCancel)
Cancel execution of this future without interrupting a running thread. SeeFuture.cancel(boolean)for details.- Parameters:
toCancel- the future to cancel- Returns:
- false if the future could not be cancelled, otherwise true
-
get
public static <T> T get(Future<T> future)
CallsFuture.get()without the checked exceptions.- Type Parameters:
T- the type returned- Parameters:
future- to dereference- Returns:
- the value of the future
-
get
public static <T> T get(Future<T> future, long timeout, TimeUnit unit)
CallsFuture.get(long, TimeUnit)without the checked exceptions.- Type Parameters:
T- the type returned- Parameters:
future- to dereferencetimeout- to waitunit- for timeout- Returns:
- the value of the future
-
rethrowExecutionException
public static RuntimeException rethrowExecutionException(ExecutionException e)
-
-