mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-06 13:27:55 +08:00
[fix] 优化负载获取可以使用的客户端
This commit is contained in:
parent
30e1141ecf
commit
1924e87c7d
@ -36,8 +36,8 @@ public class HandleDistributeConnectSuccessNotificationTypeAdvancedHandle extend
|
||||
|
||||
// 存储其他客户端状态
|
||||
List<String> clientIdList = JSONObject.parseArray(new String(msg.getData()), String.class);
|
||||
for (String tenantId : clientIdList) {
|
||||
clientChangeEvent.clientOnLine(tenantId);
|
||||
for (String clientId : clientIdList) {
|
||||
clientChangeEvent.clientOnLine(clientId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,7 +56,9 @@ public class NettyClientVisitorContext {
|
||||
public static <T> void removeVisitorSocket(String clientId, T visitorSocket) {
|
||||
List<Object> visitorSocketList = VISITOR_SOCKET.get(clientId);
|
||||
if(!ObjectUtils.isEmpty(visitorSocketList)){
|
||||
visitorSocketList.remove(visitorSocket);
|
||||
while(visitorSocketList.iterator().hasNext()){
|
||||
visitorSocketList.iterator().remove();
|
||||
}
|
||||
VISITOR_SOCKET.put(clientId,visitorSocketList);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package org.framework.lazy.cloud.network.heartbeat.server.standalone.application
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
||||
|
||||
import java.lang.String;
|
||||
import java.time.LocalDateTime;
|
||||
import java.lang.Long;
|
||||
@ -45,7 +47,7 @@ public class LazyNettyClientStateRecordQueryListCommand {
|
||||
* 在线状态(true在线,false离线)
|
||||
*/
|
||||
@Schema(description ="在线状态(true在线,false离线)",name ="onLineState",example = "")
|
||||
private String onLineState;
|
||||
private NettyClientStatus onLineState;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -63,5 +63,12 @@ public class LazyNettyClientStateRecordDTO {
|
||||
*/
|
||||
@Schema(description ="暂存状态(开启、关闭)",name ="stagingState",example = "")
|
||||
private String stagingState;
|
||||
/**
|
||||
* 原始IP
|
||||
* byte[] 长度 4
|
||||
*
|
||||
* @since 1.2.9
|
||||
*/
|
||||
private String originalIp;
|
||||
|
||||
}
|
@ -209,7 +209,6 @@ public class LazyNettyClientStateApplicationImpl implements LazyNettyClientState
|
||||
// 关闭访客
|
||||
List<NettyServerPermeateClientVisitorSocket> nettyServerPermeateClientVisitorSocketList = NettyClientVisitorContext.getVisitorSockets(clientId);
|
||||
if (!ObjectUtils.isEmpty(nettyServerPermeateClientVisitorSocketList)) {
|
||||
log.info("size:{}",nettyServerPermeateClientVisitorSocketList.size());
|
||||
for (NettyServerPermeateClientVisitorSocket nettyServerPermeateClientVisitorSocket : nettyServerPermeateClientVisitorSocketList) {
|
||||
nettyServerPermeateClientVisitorSocket.close();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user