Package org.shakespeareframework
Interface RetryableQuestion<A>
A
Question that will be retried until it yields an answer deemed acceptable(A) or
the timeout is reached. Exceptions thrown will be ignored
if they match the isIgnoredException predicate.-
Field Summary
Fields inherited from interface org.shakespeareframework.Retryable
DEFAULT_TIMEOUT -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanacceptable(A answer) This determines if a given answer is acceptable.default booleanisIgnoredException(Exception exception) Methods inherited from interface org.shakespeareframework.Retryable
getInterval, getTimeout
-
Method Details
-
getIgnoredExceptions
-
isIgnoredException
- Parameters:
exception- theExceptionthat made the retry necessary- Returns:
- the predicate that decides weather the exception will be ignored when thrown in a retry
-
acceptable
This determines if a given answer is acceptable. In that case the retrying will be stopped and the answer is returned.By default this will accept
- a
Optional.isPresent(), - a !
Collection.isEmpty(), - a !
Map.isEmpty(), - an array with length > 0, and
- a
Boolean.TRUE.
- Parameters:
answer- an answer- Returns:
trueif the given answer is acceptable
- a
-