Class RetryHandler
java.lang.Object
io.spiffe.workloadapi.retry.RetryHandler
Provides methods to schedule the execution of retries based on a backoff policy.
-
Constructor Summary
ConstructorsConstructorDescriptionRetryHandler(ExponentialBackoffPolicy exponentialBackoffPolicy, ScheduledExecutorService executor) -
Method Summary
Modifier and TypeMethodDescriptionintvoidreset()Reset state of RetryHandle to initial values.voidscheduleRetry(Runnable runnable) Schedule to execute a Runnable, based on the backoff policy Updates the next delay and retries count.booleanReturns true is a new retry should be performs, according the the Retry Policy.
-
Constructor Details
-
RetryHandler
public RetryHandler(ExponentialBackoffPolicy exponentialBackoffPolicy, ScheduledExecutorService executor)
-
-
Method Details
-
scheduleRetry
Schedule to execute a Runnable, based on the backoff policy Updates the next delay and retries count.- Parameters:
runnable- the task to be scheduled for execution
-
shouldRetry
public boolean shouldRetry()Returns true is a new retry should be performs, according the the Retry Policy.- Returns:
- true is a new retry should be performs, according the the Retry Policy
-
reset
public void reset()Reset state of RetryHandle to initial values. -
getNextDelay
-
getRetryCount
public int getRetryCount()
-