Package io.github.resilience4j.retry
Interface Retry.Context<T>
- Type Parameters:
T
- the result type
- All Known Implementing Classes:
RetryImpl.ContextImpl
- Enclosing interface:
- Retry
public static interface Retry.Context<T>
the retry context which will be used during the retry iteration to decide what can be done on
error , result, on runtime error
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Records a successful call or retryable call with the needed generated retry events.void
Handles a checked exceptionboolean
void
onRuntimeError
(RuntimeException runtimeException) Handles a runtime exception
-
Method Details
-
onComplete
void onComplete()Records a successful call or retryable call with the needed generated retry events. When there is a successful retry before reaching the max retries limit, it will generate aRetryOnSuccessEvent
. When the retry reaches the max retries limit, it will generate aRetryOnErrorEvent
with last exception orMaxRetriesExceeded
if no other exceptions is thrown. -
onResult
- Parameters:
result
- the returned result from the called logic- Returns:
- true if we need to retry again or false if no retry anymore
-
onError
Handles a checked exception- Parameters:
exception
- the exception to handle- Throws:
Exception
- when retry count has exceeded
-
onRuntimeError
Handles a runtime exception- Parameters:
runtimeException
- the exception to handle- Throws:
RuntimeException
- when retry count has exceeded
-