package org.embulk.input;

import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
import org.apache.http.protocol.HttpContext;
import org.embulk.spi.Exec;
import org.slf4j.Logger;

import javax.net.ssl.SSLException;
import java.io.IOException;
import java.net.ConnectException;
import java.net.UnknownHostException;
import java.util.Arrays;

public class RetryHandler extends DefaultHttpRequestRetryHandler
{

    private final Logger logger = Exec.getLogger(getClass());

    private int interval = 0;

    public RetryHandler(int retry, int interval)
    {
        super(retry, true, Arrays.asList(
                UnknownHostException.class,
                ConnectException.class,
                SSLException.class));
        this.interval = interval;
    }

    @Override
    public boolean retryRequest(final IOException exception,
                                final int executionCount, final HttpContext context)
    {
        final boolean isRertriable = super.retryRequest(exception, executionCount, context);
        if (isRertriable) {
            try {
                logger.info(String.format("Sleep %d msec before retry", interval));
                Thread.sleep(interval);
            } catch (InterruptedException e) {}
        }
        return isRertriable;
    }

}

@@ -957,25 +957,24 @@
 boolean isRe
-r
 triable = su
@@ -1039,25 +1039,24 @@
     if (isRe
-r
 triable) %7B%0A 
@@ -1273,17 +1273,16 @@
 urn isRe
-r
 triable;

fix typo