-
- Enclosing class:
- RetryInterceptor
public static interface RetryInterceptor.ListenerA listener forRetryInterceptorevents. Useful for logging, metrics collection, and monitoring retry behavior.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default 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(java.net.http.HttpRequest request)Called when the interceptor is about to send the request for the first time.default voidonRetry(RetryInterceptor.Context<?> context, java.net.http.HttpRequest nextRequest, java.time.Duration delay)Called when the interceptor is about to retry a request.
-
-
-
Method Detail
-
onFirstAttempt
default void onFirstAttempt(java.net.http.HttpRequest request)
Called when the interceptor is about to send the request for the first time.
-
onRetry
default void onRetry(RetryInterceptor.Context<?> context, java.net.http.HttpRequest nextRequest, java.time.Duration delay)
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
default void onComplete(RetryInterceptor.Context<?> context)
Called when the interceptor is about to return the given state as-is because no retry condition matches.
-
onExhaustion
default void onExhaustion(RetryInterceptor.Context<?> context)
Called when the interceptor exhausts allowed retry attempts. The given context'sRetryInterceptor.Context.retryCount()equals the specifiedRetryInterceptor.Builder.maxRetries(int).
-
-