REM:
1. 可配置DP设备访问SOAP接口超时时间
This commit is contained in:
HuangXin 2020-07-06 10:33:23 +08:00
parent 2b9b48d3ff
commit 520acd9d8e
5 changed files with 59 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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.
*/

View File

@ -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 <huangxin@cmhi.chinamoblie.com>
*/
@Getter
@Setter
@Component
@ConfigurationProperties(prefix = "dptech")
public class DpTechConfigure {
private String soapConnTimeout;
private String soapRecvTimeout;
}

View File

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