summaryrefslogtreecommitdiffstats
path: root/node-admin
diff options
context:
space:
mode:
authorHarald Musum <musum@yahoo-inc.com>2017-05-17 09:57:28 +0200
committerHarald Musum <musum@yahoo-inc.com>2017-05-17 09:57:28 +0200
commit9682542142a7b3d6a12ee81173e866fd2de84952 (patch)
treeaf80e3816b2889136b96615062eab0610831952c /node-admin
parent940e6f1c75d448ca6de0ae888fe119a16432ea5e (diff)
Disable automtic retries in http client
* We have our own retrying outside of this, if the client retries that is not working as expected
Diffstat (limited to 'node-admin')
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/ConfigServerHttpRequestExecutor.java18
1 files changed, 2 insertions, 16 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/ConfigServerHttpRequestExecutor.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/ConfigServerHttpRequestExecutor.java
index 87eb80c1837..aaf45039cb1 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/ConfigServerHttpRequestExecutor.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/ConfigServerHttpRequestExecutor.java
@@ -3,7 +3,6 @@ package com.yahoo.vespa.hosted.node.admin.util;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpDelete;
@@ -19,16 +18,13 @@ import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import javax.ws.rs.core.Response;
-import java.io.BufferedReader;
import java.io.IOException;
-import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Set;
-import java.util.stream.Collectors;
/**
* Retries request on config server a few times before giving up. Assumes that all requests should be sent with
@@ -59,8 +55,8 @@ public class ConfigServerHttpRequestExecutor {
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
// Increase max total connections to 200, which should be enough
cm.setMaxTotal(200);
- return new ConfigServerHttpRequestExecutor(configServerHosts, HttpClientBuilder.create()
- .setConnectionManager(cm).build());
+ return new ConfigServerHttpRequestExecutor(configServerHosts,
+ HttpClientBuilder.create().disableAutomaticRetries().setConnectionManager(cm).build());
}
ConfigServerHttpRequestExecutor(Set<String> configServerHosts, CloseableHttpClient client) {
@@ -153,16 +149,6 @@ public class ConfigServerHttpRequestExecutor {
}, wantedReturnType);
}
- private static String read(HttpEntity input) {
- try {
- try (BufferedReader buffer = new BufferedReader(new InputStreamReader(input.getContent()))) {
- return buffer.lines().collect(Collectors.joining("\n"));
- }
- } catch (IOException e) {
- return "Failed reading stream: " + e.getMessage();
- }
- }
-
private void setContentTypeToApplicationJson(HttpRequestBase request) {
request.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
}