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. Exception
s 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 boolean
acceptable
(A answer) This determines if a given answer is acceptable.default boolean
isIgnoredException
(Exception exception) Methods inherited from interface org.shakespeareframework.Retryable
getInterval, getTimeout
-
Method Details
-
getIgnoredExceptions
-
isIgnoredException
- Parameters:
exception
- theException
that 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:
true
if the given answer is acceptable
- a
-