public class AttemptTimeLimiters
extends java.lang.Object
AttemptTimeLimiter
Modifier and Type | Method and Description |
---|---|
static <V> AttemptTimeLimiter<V> |
fixedTimeLimit(long duration,
java.util.concurrent.TimeUnit timeUnit)
For control over thread management, it is preferable to offer an
ExecutorService through the other
factory method, fixedTimeLimit(long, TimeUnit, ExecutorService) . |
static <V> AttemptTimeLimiter<V> |
fixedTimeLimit(long duration,
java.util.concurrent.TimeUnit timeUnit,
java.util.concurrent.ExecutorService executorService) |
static <V> AttemptTimeLimiter<V> |
noTimeLimit() |
public static <V> AttemptTimeLimiter<V> noTimeLimit()
V
- The type of the computation result.AttemptTimeLimiter
impl which has no time limitpublic static <V> AttemptTimeLimiter<V> fixedTimeLimit(long duration, @Nonnull java.util.concurrent.TimeUnit timeUnit)
ExecutorService
through the other
factory method, fixedTimeLimit(long, TimeUnit, ExecutorService)
. See the note on
SimpleTimeLimiter.SimpleTimeLimiter(ExecutorService)
, which this AttemptTimeLimiter uses.V
- the type of the computation resultduration
- that an attempt may persist before being circumventedtimeUnit
- of the 'duration' argAttemptTimeLimiter
with a fixed time limit for each attemptpublic static <V> AttemptTimeLimiter<V> fixedTimeLimit(long duration, @Nonnull java.util.concurrent.TimeUnit timeUnit, @Nonnull java.util.concurrent.ExecutorService executorService)
V
- the type of the computation resultduration
- that an attempt may persist before being circumventedtimeUnit
- of the 'duration' argexecutorService
- used to enforce time limitAttemptTimeLimiter
with a fixed time limit for each attempt