From d6541c02023fdf504a4cae2aaefb01e80e807e1d Mon Sep 17 00:00:00 2001 From: greysonfang Date: Fri, 21 Jul 2023 17:14:37 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat=EF=BC=9Ahttp=E8=AF=BB=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E8=BF=9E=E6=8E=A5=E5=BB=B6=E9=95=BF=E8=87=B360s=20#60?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iam/service/impl/ApigwHttpClientServiceImpl.java | 10 ++-------- .../iam/util/http/DefaultApacheHttpClientBuilder.java | 6 +++--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/tencent/bk/sdk/iam/service/impl/ApigwHttpClientServiceImpl.java b/src/main/java/com/tencent/bk/sdk/iam/service/impl/ApigwHttpClientServiceImpl.java index 9df9b20..f7f90f1 100644 --- a/src/main/java/com/tencent/bk/sdk/iam/service/impl/ApigwHttpClientServiceImpl.java +++ b/src/main/java/com/tencent/bk/sdk/iam/service/impl/ApigwHttpClientServiceImpl.java @@ -41,16 +41,10 @@ @Slf4j public class ApigwHttpClientServiceImpl implements HttpClientService { - private final CloseableHttpClient httpClient; - private final IamConfiguration iamConfiguration; + private CloseableHttpClient httpClient = DefaultApacheHttpClientBuilder.get().build(); + private IamConfiguration iamConfiguration; public ApigwHttpClientServiceImpl(IamConfiguration iamConfiguration) { - this.httpClient = DefaultApacheHttpClientBuilder.get().build(); - this.iamConfiguration = iamConfiguration; - } - - public ApigwHttpClientServiceImpl(CloseableHttpClient httpClient, IamConfiguration iamConfiguration) { - this.httpClient = httpClient; this.iamConfiguration = iamConfiguration; } diff --git a/src/main/java/com/tencent/bk/sdk/iam/util/http/DefaultApacheHttpClientBuilder.java b/src/main/java/com/tencent/bk/sdk/iam/util/http/DefaultApacheHttpClientBuilder.java index bf55e55..e4b7d82 100644 --- a/src/main/java/com/tencent/bk/sdk/iam/util/http/DefaultApacheHttpClientBuilder.java +++ b/src/main/java/com/tencent/bk/sdk/iam/util/http/DefaultApacheHttpClientBuilder.java @@ -51,7 +51,7 @@ public class DefaultApacheHttpClientBuilder implements ApacheHttpClientBuilder { private final AtomicBoolean prepared = new AtomicBoolean(false); private int connectionRequestTimeout = 3000; private int connectionTimeout = 5000; - private int soTimeout = 5000; + private int soTimeout = 60000; private int idleConnTimeout = 60000; private int checkWaitTime = 60000; private int maxConnPerHost = 10; @@ -140,9 +140,9 @@ public void setConnectionTimeout(int connectionTimeout) { } /** - * 默认NIO的socket超时设置,默认5000ms. + * 默认NIO的socket超时设置,默认60S. * - * @param soTimeout 默认NIO的socket超时设置,默认5000ms. + * @param soTimeout 默认NIO的socket超时设置,默认60S. * @see java.net.SocketOptions#SO_TIMEOUT */ public void setSoTimeout(int soTimeout) { From fd605fee004b3bf56654e2ab2a55bee172c3bba0 Mon Sep 17 00:00:00 2001 From: greysonfang Date: Fri, 21 Jul 2023 17:15:37 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat=EF=BC=9Ahttp=E8=AF=BB=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E8=BF=9E=E6=8E=A5=E5=BB=B6=E9=95=BF=E8=87=B360s=20#60?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index f25d8fb..ba40265 100644 --- a/build.gradle +++ b/build.gradle @@ -33,7 +33,7 @@ ext { set("junitVersion", "5.4.2") if (System.getProperty("snapshot") == "true") { - set('iamVersion', "1.0.29-SNAPSHOT") + set('iamVersion', "1.0.30-SNAPSHOT") } else { set('iamVersion', "1.0.0") }