From 59c6d4121663bb536efa990c6fffe1bd4b26dd87 Mon Sep 17 00:00:00 2001 From: Dermot Smyth Date: Wed, 14 Feb 2018 18:18:48 +0100 Subject: [PATCH] #244: Issues with http manage client connection sharing - disabled connection sharing --- src/main/java/com/marklogic/rest/util/RestTemplateUtil.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/marklogic/rest/util/RestTemplateUtil.java b/src/main/java/com/marklogic/rest/util/RestTemplateUtil.java index e77219fe6..e85519ee8 100644 --- a/src/main/java/com/marklogic/rest/util/RestTemplateUtil.java +++ b/src/main/java/com/marklogic/rest/util/RestTemplateUtil.java @@ -6,6 +6,7 @@ import org.apache.http.conn.ssl.SSLContextBuilder; import org.apache.http.conn.ssl.TrustStrategy; import org.apache.http.conn.ssl.X509HostnameVerifier; +import org.apache.http.impl.NoConnectionReuseStrategy; import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.HttpClientBuilder; import org.slf4j.Logger; @@ -58,6 +59,7 @@ public static RestTemplate newRestTemplate(RestConfig config) { httpClientBuilder.setHostnameVerifier(config.getHostnameVerifier()); } + httpClientBuilder.setConnectionReuseStrategy(new NoConnectionReuseStrategy()); HttpClient client = httpClientBuilder.build(); RestTemplate rt = new RestTemplate(new HttpComponentsClientHttpRequestFactory(client));