- All Known Implementing Classes:
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
execute(java.util.function.Supplier) method of each policy
implementation must perform at least one attempt to load the data, even if it
chooses not to retry in case of errors.
execute<T> T execute
(Supplier<T> call)Invokes the provided
Supplierto read the source data and returns that data.
The implementation of this method incorporates the retry logic.
- Type Parameters:
T- result type
call- supplier of
- loaded data returned by the provided
canceldefault boolean cancel
(boolean mayInterruptIfRunning)Cancels the current use of the retry policy.
Implementations should correctly handle three cases:
cancelinvoked when no invocation of
executeis in progress,
cancelinvoked when an invocation of
executeis active but no attempted load is actually in progress (e.g., a prior attempt failed and the retry policy is waiting for some time to pass before trying again), and
cancelinvoked while a load attempt is in progress.
mayInterruptIfRunning- whether an in-progress load attempt should be interrupted
falseif the task could not be canceled, typically because it has already completed;
getdefault RetryPolicy get()