Skip to content

Commit

Permalink
Disable Apache HTTP Client retry in WaitUtil
Browse files Browse the repository at this point in the history
WaitUtil has it's own retry mechanism and by disabling the HTTP Client retries it is easier to debug issues with containers starting.

Also HTTP Client retries provide superfluous logging considering it is highly likely the system will be unavailable when the first check occurs.

Signed-off-by: James Baker <james@brighthelix.co.uk>
  • Loading branch information
James Baker committed Sep 25, 2015
1 parent 84a19b8 commit 0603386
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 0603386

Please sign in to comment.