All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.turbospaces.http.CustomHttpRequestRetryHandler Maven / Gradle / Ivy

The newest version!
package com.turbospaces.http;

import java.io.IOException;

import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
import org.apache.http.protocol.HttpContext;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class CustomHttpRequestRetryHandler extends DefaultHttpRequestRetryHandler {

    public CustomHttpRequestRetryHandler(int retryCount, boolean requestSentRetryEnabled) {
        super(retryCount, requestSentRetryEnabled);
    }
    @Override
    public boolean retryRequest(final IOException exception,
            final int executionCount,
            final HttpContext context) {
        var retry = super.retryRequest(exception, executionCount, context);
        if (retry) {
            log.warn("About to retry http request with error", exception);
        }
        return retry;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy