public final class TimerUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static long |
resolveTimeoutInMillis(Supplier<Optional<Duration>> supplier,
Duration fallback) |
static <T> TimeoutTracker |
timeAsyncTaskIfNeeded(CompletableFuture<T> completableFuture,
ScheduledExecutorService timeoutExecutor,
SdkClientException exceptionToThrow,
long timeoutInMills)
Schedule a
TimeoutTask and exceptional completes a CompletableFuture with the provide exception
if not otherwise completed before the given timeout. |
static TimeoutTracker |
timeSyncTaskIfNeeded(ScheduledExecutorService timeoutExecutor,
long timeoutInMills,
Thread threadToInterrupt)
Schedule a
TimeoutTask that aborts the task if not otherwise completed before the given timeout. |
public static <T> TimeoutTracker timeAsyncTaskIfNeeded(CompletableFuture<T> completableFuture, ScheduledExecutorService timeoutExecutor, SdkClientException exceptionToThrow, long timeoutInMills)
TimeoutTask and exceptional completes a CompletableFuture with the provide exception
if not otherwise completed before the given timeout.T - the type of the CompletableFuturecompletableFuture - the completableFuture to be timedtimeoutExecutor - the executor to execute the TimeoutTaskexceptionToThrow - the exception to thrown after timeouttimeoutInMills - the timeout in milliseconds.TimeoutTrackerpublic static TimeoutTracker timeSyncTaskIfNeeded(ScheduledExecutorService timeoutExecutor, long timeoutInMills, Thread threadToInterrupt)
TimeoutTask that aborts the task if not otherwise completed before the given timeout.timeoutExecutor - the executor to execute the TimeoutTasktimeoutInMills - the timeout in milliseconds.threadToInterrupt - the thread to interruptTimeoutTrackerCopyright © 2017 Amazon Web Services, Inc. All Rights Reserved.