public final class FutureUtil extends Object
waitWithDeadline(java.util.Collection, long, java.util.concurrent.TimeUnit, long, java.util.concurrent.TimeUnit)| Modifier and Type | Class and Description |
|---|---|
static interface |
FutureUtil.ExceptionHandler
Internally used interface to define behavior of the FutureUtil methods when exceptions arise
|
| Modifier and Type | Field and Description |
|---|---|
static FutureUtil.ExceptionHandler |
IGNORE_ALL_EXCEPT_LOG_MEMBER_LEFT
Ignores all exceptions but still logs
MemberLeftException per future and just tries
to finish all of the given ones. |
static FutureUtil.ExceptionHandler |
IGNORE_ALL_EXCEPTIONS
Ignores all exceptions
|
static FutureUtil.ExceptionHandler |
RETHROW_ALL_EXCEPT_MEMBER_LEFT
This ExceptionHandler rethrows
ExecutionExceptions and logs
MemberLeftExceptions to the log. |
static FutureUtil.ExceptionHandler |
RETHROW_EVERYTHING
Just rethrows all exceptions
|
static FutureUtil.ExceptionHandler |
RETHROW_EXECUTION_EXCEPTION
This ExceptionHandler rethrows
ExecutionExceptions and logs
MemberLeftExceptions to the log. |
static FutureUtil.ExceptionHandler |
RETHROW_TRANSACTION_EXCEPTION
Handler for transaction specific rethrown of exceptions.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
allDone(Collection<Future> futures)
Check if all futures are done
|
static void |
checkAllDone(Collection<Future> futures)
Rethrow exeception of the fist future that completed with an exception
|
static List<Future> |
getAllDone(Collection<Future> futures)
Get all futures that are done
|
static FutureUtil.ExceptionHandler |
logAllExceptions(ILogger logger,
Level level)
This ExceptionHandler rethrows
ExecutionExceptions and logs
MemberLeftExceptions to the log. |
static FutureUtil.ExceptionHandler |
logAllExceptions(ILogger logger,
String message,
Level level)
This ExceptionHandler rethrows
ExecutionExceptions and logs
MemberLeftExceptions to the log. |
static FutureUtil.ExceptionHandler |
logAllExceptions(Level level)
This ExceptionHandler rethrows
ExecutionExceptions and logs
MemberLeftExceptions to the log. |
static FutureUtil.ExceptionHandler |
logAllExceptions(String message,
Level level)
This ExceptionHandler rethrows
ExecutionExceptions and logs
MemberLeftExceptions to the log. |
static <V> Collection<V> |
returnWithDeadline(Collection<Future<V>> futures,
long timeout,
TimeUnit timeUnit) |
static <V> Collection<V> |
returnWithDeadline(Collection<Future<V>> futures,
long timeout,
TimeUnit timeUnit,
FutureUtil.ExceptionHandler exceptionHandler) |
static <V> Collection<V> |
returnWithDeadline(Collection<Future<V>> futures,
long overallTimeout,
TimeUnit overallTimeUnit,
long perFutureTimeout,
TimeUnit perFutureTimeUnit) |
static <V> Collection<V> |
returnWithDeadline(Collection<Future<V>> futures,
long overallTimeout,
TimeUnit overallTimeUnit,
long perFutureTimeout,
TimeUnit perFutureTimeUnit,
FutureUtil.ExceptionHandler exceptionHandler) |
static void |
waitForever(Collection<? extends Future> futures) |
static void |
waitForever(Collection<? extends Future> futuresToWaitFor,
FutureUtil.ExceptionHandler exceptionHandler) |
static List<Throwable> |
waitUntilAllResponded(Collection<? extends Future> futures) |
static void |
waitUntilAllRespondedWithDeadline(Collection<? extends Future> futures,
long timeout,
TimeUnit timeUnit,
FutureUtil.ExceptionHandler exceptionHandler) |
static void |
waitWithDeadline(Collection<? extends Future> futures,
long timeout,
TimeUnit timeUnit) |
static void |
waitWithDeadline(Collection<? extends Future> futures,
long timeout,
TimeUnit timeUnit,
FutureUtil.ExceptionHandler exceptionHandler) |
static void |
waitWithDeadline(Collection<? extends Future> futures,
long overallTimeout,
TimeUnit overallTimeUnit,
long perFutureTimeout,
TimeUnit perFutureTimeUnit) |
static void |
waitWithDeadline(Collection<? extends Future> futures,
long overallTimeout,
TimeUnit overallTimeUnit,
long perFutureTimeout,
TimeUnit perFutureTimeUnit,
FutureUtil.ExceptionHandler exceptionHandler) |
public static final FutureUtil.ExceptionHandler RETHROW_EVERYTHING
public static final FutureUtil.ExceptionHandler IGNORE_ALL_EXCEPTIONS
public static final FutureUtil.ExceptionHandler IGNORE_ALL_EXCEPT_LOG_MEMBER_LEFT
MemberLeftException per future and just tries
to finish all of the given ones. This is the default behavior if nothing else is given.public static final FutureUtil.ExceptionHandler RETHROW_EXECUTION_EXCEPTION
ExecutionExceptions and logs
MemberLeftExceptions to the log.public static final FutureUtil.ExceptionHandler RETHROW_ALL_EXCEPT_MEMBER_LEFT
ExecutionExceptions and logs
MemberLeftExceptions to the log.public static final FutureUtil.ExceptionHandler RETHROW_TRANSACTION_EXCEPTION
@PrivateApi public static FutureUtil.ExceptionHandler logAllExceptions(ILogger logger, String message, Level level)
ExecutionExceptions and logs
MemberLeftExceptions to the log.logger - the ILogger instance to be used for loggingmessage - the log message to appear in the logs before the stacktracelevel - the log level to be used for logging@PrivateApi public static FutureUtil.ExceptionHandler logAllExceptions(String message, Level level)
ExecutionExceptions and logs
MemberLeftExceptions to the log.message - the log message to appear in the logs before the stacktracelevel - the log level to be used for logging@PrivateApi public static FutureUtil.ExceptionHandler logAllExceptions(ILogger logger, Level level)
ExecutionExceptions and logs
MemberLeftExceptions to the log.logger - the ILogger instance to be used for logginglevel - the log level to be used for logging@PrivateApi public static FutureUtil.ExceptionHandler logAllExceptions(Level level)
ExecutionExceptions and logs
MemberLeftExceptions to the log.level - the log level to be used for logging@PrivateApi public static <V> Collection<V> returnWithDeadline(Collection<Future<V>> futures, long timeout, TimeUnit timeUnit)
@PrivateApi public static <V> Collection<V> returnWithDeadline(Collection<Future<V>> futures, long timeout, TimeUnit timeUnit, FutureUtil.ExceptionHandler exceptionHandler)
@PrivateApi public static <V> Collection<V> returnWithDeadline(Collection<Future<V>> futures, long overallTimeout, TimeUnit overallTimeUnit, long perFutureTimeout, TimeUnit perFutureTimeUnit)
@PrivateApi public static <V> Collection<V> returnWithDeadline(Collection<Future<V>> futures, long overallTimeout, TimeUnit overallTimeUnit, long perFutureTimeout, TimeUnit perFutureTimeUnit, FutureUtil.ExceptionHandler exceptionHandler)
@PrivateApi public static void waitForever(Collection<? extends Future> futuresToWaitFor, FutureUtil.ExceptionHandler exceptionHandler)
@PrivateApi public static void waitForever(Collection<? extends Future> futures)
@PrivateApi public static void waitWithDeadline(Collection<? extends Future> futures, long timeout, TimeUnit timeUnit)
@PrivateApi public static void waitUntilAllRespondedWithDeadline(Collection<? extends Future> futures, long timeout, TimeUnit timeUnit, FutureUtil.ExceptionHandler exceptionHandler)
@PrivateApi public static List<Throwable> waitUntilAllResponded(Collection<? extends Future> futures)
@PrivateApi public static void waitWithDeadline(Collection<? extends Future> futures, long timeout, TimeUnit timeUnit, FutureUtil.ExceptionHandler exceptionHandler)
@PrivateApi public static void waitWithDeadline(Collection<? extends Future> futures, long overallTimeout, TimeUnit overallTimeUnit, long perFutureTimeout, TimeUnit perFutureTimeUnit)
@PrivateApi public static void waitWithDeadline(Collection<? extends Future> futures, long overallTimeout, TimeUnit overallTimeUnit, long perFutureTimeout, TimeUnit perFutureTimeUnit, FutureUtil.ExceptionHandler exceptionHandler)
public static boolean allDone(Collection<Future> futures)
futures - the list of futurestrue if all futures are donepublic static void checkAllDone(Collection<Future> futures) throws Exception
futures - Exceptionpublic static List<Future> getAllDone(Collection<Future> futures)
futures - Copyright © 2020 Hazelcast, Inc.. All Rights Reserved.