开发提醒rpc

master
duhui 2021-11-17 14:52:52 +08:00
parent c78e2b6e20
commit e39a71fc50
1 changed files with 15 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package com.jmfy.utils;
import com.jmfy.dao.ServerInfoDao;
import com.jmfy.handler.DingTalkLogic;
import com.jmfy.handler.GMHandler;
import com.jmfy.model.AutoServerSetting;
import com.jmfy.model.CServerOpenTime;
import com.jmfy.model.ServerInfo;
@ -146,9 +147,22 @@ public class AutoServerManager {
String cont;
try {
int i = 0;
// rpc信息获取
String rpcString = RedisUtil.getInstence().getObject(RedisUserKey.LOGIC_SERVER_INFO, serverId, String.class, -1);
if (null == rpcString || rpcString.split(":").length < 2) {
LOGGER.error("服务器验证状态异常, 获取rpc参数报错serverId:{}", serverId);
return false;
}
String content = GMHandler.getCmdContent("serverstatus", serverId);
String thriftIp = rpcString.split(":")[0];
String thriftPort = rpcString.split(":")[1];
if (StringUtil.isEmpty(content) || StringUtil.isEmpty(thriftIp) || StringUtil.isEmpty(thriftPort)) {
LOGGER.error("服务器验证状态异常, rpc参数存在空值content{}thriftIp{}thriftPort{}",content,thriftIp,thriftPort);
return false;
}
do {
// 发送rpc到游戏服
Result result1 = RPCClient.sendCmd(Integer.parseInt(serverId), "serverstatus " + serverId);
Result result1 = RPCClient.gmSend(" " + serverId,thriftIp,thriftPort);
if (result1 == null) {
// result1为空表示rpc发送失败最多重复三次
LOGGER.error("服务器验证状态异常,报null第{}次重试",i+1);