Package io.atlassian.fugue.retry
Class RetrySupplier<T>
java.lang.Object
io.atlassian.fugue.retry.RetrySupplier<T>
- Type Parameters:
T- The type of the result the Supplier yields upon application
- All Implemented Interfaces:
Supplier<T>
A Supplier which wraps the apply method of another Supplier and attempts it
up to a fixed number of times. This class can be used when a task is known to
be prone to occasional failure and other workarounds are not known.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Runnableprivate final ExceptionHandlerprivate final int -
Constructor Summary
ConstructorsConstructorDescriptionRetrySupplier(Supplier<T> supplier, int tries) An instance that does nothing before retrying and ignores exceptions that occur.RetrySupplier(Supplier<T> supplier, int tries, ExceptionHandler handler) An instance that does nothing before retrying.RetrySupplier(Supplier<T> supplier, int tries, ExceptionHandler handler, Runnable beforeRetry) Constructor for RetrySupplier. -
Method Summary
-
Field Details
-
supplier
-
tries
private final int tries -
handler
-
beforeRetry
-
-
Constructor Details
-
RetrySupplier
An instance that does nothing before retrying and ignores exceptions that occur.- Parameters:
supplier- which fetches the result, must not be nulltries- the number of times to attempt to get a result, must be positive
-
RetrySupplier
An instance that does nothing before retrying.- Parameters:
supplier- which fetches the result, must not be nulltries- the number of times to attempt to get a result, must be positivehandler- reacts to exceptions thrown by the supplier, must not be null
-
RetrySupplier
public RetrySupplier(Supplier<T> supplier, int tries, ExceptionHandler handler, Runnable beforeRetry) Constructor for RetrySupplier.
- Parameters:
supplier- which fetches the result, must not be nulltries- the number of times to attempt to get a result, must be positivehandler- reacts to exceptions thrown by the supplier, must not be nullbeforeRetry- a task which will run at the end of any
-
-
Method Details