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
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidonComplete()Records a successful call or retryable call with the needed generated retry events.voidonError(java.lang.Exception exception)Handles a checked exceptionbooleanonResult(T result)voidonRuntimeError(java.lang.RuntimeException runtimeException)Handles a runtime exceptionvoidonSuccess()Deprecated.since 1.2.0
-
-
-
Method Detail
-
onSuccess
@Deprecated void onSuccess()
Deprecated.since 1.2.0Records a successful call.
-
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 aRetryOnErrorEventwith last exception orMaxRetriesExceededif no other exceptions is thrown.
-
onResult
boolean onResult(T result)
- Parameters:
result- the returned result from the called logic- Returns:
- true if we need to retry again or false if no retry anymore
-
onError
void onError(java.lang.Exception exception) throws java.lang.ExceptionHandles a checked exception- Parameters:
exception- the exception to handle- Throws:
java.lang.Exception- when retry count has exceeded
-
onRuntimeError
void onRuntimeError(java.lang.RuntimeException runtimeException)
Handles a runtime exception- Parameters:
runtimeException- the exception to handle- Throws:
java.lang.RuntimeException- when retry count has exceeded
-
-