Skip to content

Commit

Permalink
Merge pull request #297 from james-bright-helix/do-not-use-http-clien…
Browse files Browse the repository at this point in the history
…t-retry-for-wait-url

Disable Apache HTTP Client retry in WaitUtil
  • Loading branch information
rhuss committed Sep 29, 2015
2 parents 0ae55a9 + 0603386 commit bb61236
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/org/jolokia/docker/maven/util/WaitUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.RequestBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
import org.apache.http.impl.client.HttpClientBuilder;

/**
Expand All @@ -34,6 +35,9 @@ public class WaitUtil {
public static final int DEFAULT_MIN_STATUS = 200;
public static final int DEFAULT_MAX_STATUS = 399;

// Disable HTTP client retries by default.
public static final int HTTP_CLIENT_RETRIES = 0;


private WaitUtil() {}

Expand Down Expand Up @@ -148,6 +152,7 @@ private boolean ping() throws IOException {
.build();
CloseableHttpClient httpClient = HttpClientBuilder.create()
.setDefaultRequestConfig(requestConfig)
.setRetryHandler(new DefaultHttpRequestRetryHandler(HTTP_CLIENT_RETRIES, false))
.build();
try {
CloseableHttpResponse response = httpClient.execute(RequestBuilder.create(method.toUpperCase()).setUri(url).build());
Expand Down

0 comments on commit bb61236

Please sign in to comment.