1、nc启动时根据配置文件随机sleep n秒,防止批量执行nc启动导致dc无法处理
This commit is contained in:
@@ -112,6 +112,14 @@ public class NmsClient{
|
||||
AlarmUtil.sendNMSErrorMsg(ErrorCode.DeamonNotExist, Utils.getLocalIp(), "i18n_client.NmsClient.ncDeamonStartException_n81i," + e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
int sleep = (int)(1+Math.random()*Contants.STARTUP_SLEEP_SECOND);
|
||||
logger.debug(String.format("startup sleep %ss", sleep));
|
||||
Thread.sleep(sleep*1000);
|
||||
} catch (Exception e) {
|
||||
logger.error("",e);
|
||||
}
|
||||
|
||||
/**
|
||||
* 相关业务操作入口
|
||||
*/
|
||||
|
||||
@@ -135,6 +135,11 @@ public class Contants {
|
||||
public static final int DATA_SEND_THREAD_PORT;
|
||||
//主动数据上报间隔 INTERVAL,单位 10 S
|
||||
public static final int DATA_SEND_THREAD_INTERVAL;
|
||||
/**
|
||||
* 启动时最大 暂停时间,为了缓解一次启动多个nc ,dc无法处理的情况
|
||||
* 默认:10s
|
||||
*/
|
||||
public static final int STARTUP_SLEEP_SECOND;
|
||||
|
||||
static{
|
||||
SYSTEM_PATH = SysConfig.getSystemDir();
|
||||
@@ -244,7 +249,11 @@ public class Contants {
|
||||
DATA_SEND_THREAD_PORT = SysConfig.getIntegerVal("data.send.thread.port", "9527");
|
||||
//主动数据上报间隔 INTERVAL,单位 10 S
|
||||
DATA_SEND_THREAD_INTERVAL = SysConfig.getIntegerVal("data.send.thread.interval", "10");
|
||||
|
||||
/*
|
||||
* 启动时最大 暂停时间,为了缓解一次启动多个nc ,dc无法处理的情况
|
||||
* 单位:s
|
||||
*/
|
||||
STARTUP_SLEEP_SECOND = SysConfig.getIntegerVal("startup.sleep.second", "10");
|
||||
|
||||
// 初始化创建文件夹
|
||||
if(!new File(localDetecConfPath).exists()){
|
||||
@@ -271,6 +280,7 @@ public class Contants {
|
||||
if(!new File(localTempDataIncomingPath).exists()){
|
||||
new File(localTempDataIncomingPath).mkdirs();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static String formatPath(String path){
|
||||
|
||||
Reference in New Issue
Block a user