You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by go...@apache.org on 2021/11/16 07:15:23 UTC
[incubator-inlong] branch release-0.11.0 updated: [INLONG-1798]RestTemplate does not read configuration from the configuration file (#1799)
This is an automated email from the ASF dual-hosted git repository.
gosonzhang pushed a commit to branch release-0.11.0
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git
The following commit(s) were added to refs/heads/release-0.11.0 by this push:
new 03caafe [INLONG-1798]RestTemplate does not read configuration from the configuration file (#1799)
03caafe is described below
commit 03caafeca9f47ac793e4b98bb954491b46fc2f22
Author: GRAYCELL-ZHOU <45...@users.noreply.github.com>
AuthorDate: Tue Nov 16 15:15:14 2021 +0800
[INLONG-1798]RestTemplate does not read configuration from the configuration file (#1799)
Co-authored-by: zhoupeng <“zhouyaobin1612@163.com”>
---
.../inlong/manager/web/config/RestTemplateConfig.java | 19 +++++++++++++------
.../src/main/resources/application-test.properties | 12 ++++++------
2 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/config/RestTemplateConfig.java b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/config/RestTemplateConfig.java
index 11e35e7..5abc3bf 100644
--- a/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/config/RestTemplateConfig.java
+++ b/inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/config/RestTemplateConfig.java
@@ -31,6 +31,7 @@ import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.protocol.HttpContext;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
@@ -51,27 +52,33 @@ public class RestTemplateConfig {
/**
* Max total
*/
- private int maxTotal = 5000;
+ @Value("${common.http-client.maxTotal}")
+ private int maxTotal;
/**
* Concurrency
*/
- private int defaultMaxPerRoute = 2000;
+ @Value("${common.http-client.defaultMaxPerRoute}")
+ private int defaultMaxPerRoute;
- private int validateAfterInactivity = 5000;
+ @Value("${common.http-client.validateAfterInactivity}")
+ private int validateAfterInactivity;
/**
* Time to connect to the server (successful handshake), timeout throws connect timeout
*/
- private int connectionTimeout = 3000;
+ @Value("${common.http-client.connectionTimeout}")
+ private int connectionTimeout;
/**
* The time for the server to return data (response), timeout throws read timeout
*/
- private int readTimeout = 10000;
+ @Value("${common.http-client.readTimeout}")
+ private int readTimeout;
/**
* Get the timeout time of the connection from the connection pool,
* and throw ConnectionPoolTimeoutException when timeout
*/
- private int connectionRequestTimeout = 3000;
+ @Value("${common.http-client.connectionRequestTimeout}")
+ private int connectionRequestTimeout;
@Bean
public PoolingHttpClientConnectionManager httpClientConnectionManager() {
diff --git a/inlong-manager/manager-web/src/main/resources/application-test.properties b/inlong-manager/manager-web/src/main/resources/application-test.properties
index b1a61c6..90d1ac4 100644
--- a/inlong-manager/manager-web/src/main/resources/application-test.properties
+++ b/inlong-manager/manager-web/src/main/resources/application-test.properties
@@ -61,9 +61,9 @@ cluster.zk.root=inlong_hive
sort.appName=inlong_app
# Configure http client
-common.http-client.maxTotal=5001
-common.http-client.defaultMaxPerRoute=2001
-common.http-client.validateAfterInactivity=5001
-common.http-client.connectionTimeout=3001
-common.http-client.readTimeout=10001
-common.http-client.connectionRequestTimeout=3001
\ No newline at end of file
+#common.http-client.maxTotal=5001
+#common.http-client.defaultMaxPerRoute=2001
+#common.http-client.validateAfterInactivity=5001
+#common.http-client.connectionTimeout=3001
+#common.http-client.readTimeout=10001
+#common.http-client.connectionRequestTimeout=3001
\ No newline at end of file