代码简化

master
duhui 2021-11-17 15:16:54 +08:00
parent f8b395df43
commit 43cb649ab7
1 changed files with 1 additions and 13 deletions

View File

@ -147,24 +147,12 @@ 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 {
// 间隔30秒再获取开服数据
Thread.sleep(DateUtil.ONE_SECOND * 30);
// 发送rpc到游戏服
Result result1 = RPCClient.gmSend(content,thriftIp,thriftPort);
Result result1 = RPCClient.sendCmd(Integer.parseInt(serverId),content);
if (result1 == null) {
// result1为空表示rpc发送失败最多重复三次
LOGGER.error("服务器验证状态异常,报null第{}次重试",i+1);