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(); }