Skip to content

Commit

Permalink
Created a more aggressive retry handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
csrster committed May 28, 2021
1 parent eca2e6f commit 90d20a8
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

import javax.net.ssl.SSLException;
Expand Down Expand Up @@ -36,7 +37,12 @@ public class HttpsClientBuilder {
* @param privateKeyFile The path to the private key file to use for authentication.
*/
public HttpsClientBuilder(String privateKeyFile) {
clientBuilder = HttpClients.custom().setRetryHandler(new DefaultHttpRequestRetryHandler(3, true));
class AggressiveHttpRequestRetryHandler extends DefaultHttpRequestRetryHandler {
public AggressiveHttpRequestRetryHandler() {
super(3, true, Arrays.asList(UnknownHostException.class));
}
}
clientBuilder = HttpClients.custom().setRetryHandler(new AggressiveHttpRequestRetryHandler());
sslProvider = new BasicTwoWaySSLProvider(privateKeyFile);
setupConnection();
}
Expand Down

0 comments on commit 90d20a8

Please sign in to comment.