From 520acd9d8e1233789fda6a2ed96e3cda7f8b0ed2 Mon Sep 17 00:00:00 2001 From: HuangXin Date: Mon, 6 Jul 2020 10:33:23 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E5=8F=AF=E9=85=8D=E7=BD=AEDP?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E8=AE=BF=E9=97=AESOAP=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B6=85=E6=97=B6=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/application-local.properties | 9 +++++-- config/application-test.properties | 6 +++++ .../java/com/dispose/common/GlobalVar.java | 4 +-- .../com/dispose/config/DpTechConfigure.java | 20 +++++++++++++++ .../java/com/dispose/config/SetupInit.java | 25 ++++++++++++++++++- 5 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/dispose/config/DpTechConfigure.java diff --git a/config/application-local.properties b/config/application-local.properties index 27611156..5d1269fb 100644 --- a/config/application-local.properties +++ b/config/application-local.properties @@ -54,5 +54,10 @@ phoenix.aes-key=Wt4EJu6Rrq5udd/42bNpCQ== #====custom config,begin with phoenix==== #调试配置 dispose.check-protocol-timeout=false -dispose.check-request-token=true -dispose.check-admin-permission=true +dispose.check-request-token=false +dispose.check-admin-permission=false +# 迪普设备配置 +# 发送超时时间(ms) +#dptech.soap-conn-timeout=5000 +# 接收超时时间(ms) +dptech.soap-recv-timeout=50000 diff --git a/config/application-test.properties b/config/application-test.properties index 08317543..47c2848d 100644 --- a/config/application-test.properties +++ b/config/application-test.properties @@ -55,3 +55,9 @@ phoenix.aes-key=Wt4EJu6Rrq5udd/42bNpCQ== dispose.check-protocol-timeout=false dispose.check-request-token=true dispose.check-admin-permission=true +# 迪普设备配置 +# 发送超时时间(ms) +#dptech.soap-conn-timeout=5000 +# 接收超时时间(ms) +dptech.soap-recv-timeout=50000 + diff --git a/src/main/java/com/dispose/common/GlobalVar.java b/src/main/java/com/dispose/common/GlobalVar.java index 27e5a5bc..1cd9a9be 100644 --- a/src/main/java/com/dispose/common/GlobalVar.java +++ b/src/main/java/com/dispose/common/GlobalVar.java @@ -10,11 +10,11 @@ public class GlobalVar { /** * The constant SOAP_CONNECT_TIMEOUT. */ - public static final int SOAP_CONNECT_TIMEOUT = 5000; + public static volatile int SOAP_CONNECT_TIMEOUT = 5000; /** * The constant SOAP_RECEIVE_TIMEOUT. */ - public static final int SOAP_RECEIVE_TIMEOUT = 5000; + public static volatile int SOAP_RECEIVE_TIMEOUT = 5000; /** * The constant MAX_THREAT_INFO_VERSION. */ diff --git a/src/main/java/com/dispose/config/DpTechConfigure.java b/src/main/java/com/dispose/config/DpTechConfigure.java new file mode 100644 index 00000000..467ab3e0 --- /dev/null +++ b/src/main/java/com/dispose/config/DpTechConfigure.java @@ -0,0 +1,20 @@ +package com.dispose.config; + +import lombok.Getter; +import lombok.Setter; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * The type Dp tech configure. + * + * @author + */ +@Getter +@Setter +@Component +@ConfigurationProperties(prefix = "dptech") +public class DpTechConfigure { + private String soapConnTimeout; + private String soapRecvTimeout; +} diff --git a/src/main/java/com/dispose/config/SetupInit.java b/src/main/java/com/dispose/config/SetupInit.java index 3c03648e..67a1d587 100644 --- a/src/main/java/com/dispose/config/SetupInit.java +++ b/src/main/java/com/dispose/config/SetupInit.java @@ -20,12 +20,35 @@ public class SetupInit implements CommandLineRunner { @Resource private DisposeConfigure disposeConfigure; + @Resource + private DpTechConfigure dpTechConfigure; + @Resource private DisposeNodeManager disposeNodeManager; @Resource private TaskService taskService; + private void loadConfigure() { + try { + GlobalVar.SOAP_CONNECT_TIMEOUT = Integer.parseInt(dpTechConfigure.getSoapConnTimeout()); + } catch(Exception ex) { + log.error("load SOAP_CONNECT_TIMEOUT configure error: {}", ex.getMessage()); + } + + try { + GlobalVar.SOAP_RECEIVE_TIMEOUT = Integer.parseInt(dpTechConfigure.getSoapRecvTimeout()); + } catch(Exception ex) { + log.error("load SOAP_RECEIVE_TIMEOUT configure error: {}", ex.getMessage()); + } + + try { + GlobalVar.IS_CHECK_REQUEST_TIMEOUT = Boolean.parseBoolean(disposeConfigure.getCheckProtocolTimeout()); + } catch(Exception ex) { + log.error("load IS_CHECK_REQUEST_TIMEOUT configure error: {}", ex.getMessage()); + } + } + /** * Run. * @@ -34,7 +57,7 @@ public class SetupInit implements CommandLineRunner { @Override public void run(String... args) { // 系统初始化入口 - GlobalVar.IS_CHECK_REQUEST_TIMEOUT = Boolean.parseBoolean(disposeConfigure.getCheckProtocolTimeout()); + loadConfigure(); disposeNodeManager.loadDisposeNodeFromDatabase(); taskService.loadTaskFromDatabase(); }