You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by al...@apache.org on 2021/11/19 02:03:51 UTC

[incubator-inlong] branch master updated: [INLONG-1798]RestTemplate does not read configuration from the configuration file (#1813)

This is an automated email from the ASF dual-hosted git repository.

aloyszhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 2907907  [INLONG-1798]RestTemplate does not read configuration from the configuration file (#1813)
2907907 is described below

commit 2907907e4d1ea6c031c7384a04aa135882dee20c
Author: GRAYCELL-ZHOU <45...@users.noreply.github.com>
AuthorDate: Fri Nov 19 10:03:43 2021 +0800

    [INLONG-1798]RestTemplate does not read configuration from the configuration file (#1813)
    
    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 cfc85d3..68022ee 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