com.signalfx.connection.RetryHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of signalfx-java Show documentation
Show all versions of signalfx-java Show documentation
SignalFx from Java client libraries
package com.signalfx.connection;
import java.io.InterruptedIOException;
import java.net.ConnectException;
import java.net.UnknownHostException;
import java.util.Arrays;
import com.signalfx.shaded.apache.http.impl.client.DefaultHttpRequestRetryHandler;
/**
* Compared to the {@link DefaultHttpRequestRetryHandler} we allow retry on {@link
* javax.net.ssl.SSLException}, because it gets thrown when we try to send data points over a
* connection that our server has already closed. It is still unknown how exactly our server closes
* "stale" connections in such a way that http client is unable to detect this.
*/
class RetryHandler extends DefaultHttpRequestRetryHandler {
public static final Integer DEFAULT_MAX_RETRIES = 3;
public RetryHandler(final int maxRetries) {
super(maxRetries, true, Arrays.asList(
InterruptedIOException.class,
UnknownHostException.class,
ConnectException.class));
}
public RetryHandler() {
super(DEFAULT_MAX_RETRIES, true, Arrays.asList(
InterruptedIOException.class,
UnknownHostException.class,
ConnectException.class));
}
}