[集群-自动切换过国标级联] 添加数据库脚本
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
package com.genersoft.iot.vmp.conf;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.genersoft.iot.vmp.common.ServerInfo;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Component
|
||||
public class WVPTimerTask {
|
||||
|
||||
@@ -19,11 +21,8 @@ public class WVPTimerTask {
|
||||
@Autowired
|
||||
private SipConfig sipConfig;
|
||||
|
||||
@Scheduled(fixedDelay = 2 * 1000) //每3秒执行一次
|
||||
@Scheduled(fixedDelay = 2, timeUnit = TimeUnit.SECONDS) //每3秒执行一次
|
||||
public void execute(){
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("ip", sipConfig.getShowIp());
|
||||
jsonObject.put("port", serverPort);
|
||||
redisCatchStorage.updateWVPInfo(jsonObject, 3);
|
||||
redisCatchStorage.updateWVPInfo(ServerInfo.create(sipConfig.getShowIp(), serverPort), 3);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user