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

com.signalfx.connection.RetryHandler Maven / Gradle / Ivy

There is a newer version: 1.0.45
Show newest version
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));
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy