Interface RetryInterceptor.Listener
- Enclosing class:
RetryInterceptor
public static interface RetryInterceptor.Listener
A listener for
RetryInterceptor events. Useful for logging, metrics collection, and
monitoring retry behavior.-
Method Summary
Modifier and TypeMethodDescriptiondefault voidonComplete(RetryInterceptor.Context<?> context) Called when the interceptor is about to return the given state as-is because no retry condition matches.default voidonExhaustion(RetryInterceptor.Context<?> context) Called when the interceptor exhausts allowed retry attempts.default voidonFirstAttempt(HttpRequest request) Called when the interceptor is about to send the request for the first time.default voidonRetry(RetryInterceptor.Context<?> context, HttpRequest nextRequest, Duration delay) Called when the interceptor is about to retry a request.
-
Method Details
-
onFirstAttempt
Called when the interceptor is about to send the request for the first time. -
onRetry
Called when the interceptor is about to retry a request. The given context specifies the retryable state. The given request and delay specify the next request to send (after any request modification) and how long to wait before sending it, respectively. -
onComplete
Called when the interceptor is about to return the given state as-is because no retry condition matches. -
onExhaustion
Called when the interceptor exhausts allowed retry attempts. The given context'sRetryInterceptor.Context.retryCount()equals the specifiedRetryInterceptor.Builder.maxRetries(int).
-