- return HttpsUtils.put(url, headers, new HashMap<>(), new StringEntity(content));\r
+ CloseableHttpClient httpClient = null;\r
+ try {\r
+ httpClient = HttpsUtils.getHttpClient(HttpsUtils.DEFUALT_TIMEOUT);\r
+ return HttpsUtils.put(url, headers, new HashMap<>(), new StringEntity(content),httpClient);\r
+ } finally {\r
+ closeHttpClient(httpClient);\r
+ }\r
+ }\r
+\r
+ private void closeHttpClient(CloseableHttpClient httpClient) {\r
+ if (httpClient != null) {\r
+ try {\r
+ httpClient.close();\r
+ } catch (IOException e) {\r
+ log.warn("Failed to close http client!");\r
+ }\r
+ }\r