perf[event]: use submit instead of other syncSubmit

This commit is contained in:
godotg
2022-12-01 19:03:06 +08:00
parent 44fffabad1
commit b97e9212b2
5 changed files with 6 additions and 6 deletions
@@ -493,7 +493,7 @@ public class ZookeeperRegistry implements IRegistry {
} else {
// 连接上了服务提供者
session.putAttribute(AttributeType.CONSUMER, providerCache);
EventBus.asyncSubmit(ConsumerStartEvent.valueOf(providerCache, session));
EventBus.submit(ConsumerStartEvent.valueOf(providerCache, session));
try {
var localRegisterVO = NetContext.getConfigManager().getLocalConfig().toLocalRegisterVO();
@@ -50,7 +50,7 @@ public class ClientRouteHandler extends BaseRouteHandler {
var consumeAttribute = session.getAttribute(AttributeType.CONSUMER);
NetContext.getSessionManager().removeClientSession(session);
EventBus.asyncSubmit(ClientSessionInactiveEvent.valueOf(session));
EventBus.submit(ClientSessionInactiveEvent.valueOf(session));
// 如果是消费者inactive,还需要触发客户端消费者检查事件,以便重新连接
if (consumeAttribute != null) {
@@ -130,7 +130,7 @@ public class GatewayRouteHandler extends ServerRouteHandler {
var uid = (Long) session.getAttribute(AttributeType.UID);
// 连接到网关的客户端断开了连接
EventBus.asyncSubmit(GatewaySessionInactiveEvent.valueOf(sid, uid == null ? 0 : uid.longValue()));
EventBus.submit(GatewaySessionInactiveEvent.valueOf(sid, uid == null ? 0 : uid.longValue()));
super.channelInactive(ctx);
}
@@ -48,7 +48,7 @@ public class ServerRouteHandler extends BaseRouteHandler {
return;
}
NetContext.getSessionManager().removeServerSession(session);
EventBus.asyncSubmit(ServerSessionInactiveEvent.valueOf(session));
EventBus.submit(ServerSessionInactiveEvent.valueOf(session));
logger.warn("server channel is inactive {}", SessionUtils.sessionSimpleInfo(ctx));
}
}
@@ -135,7 +135,7 @@ public class Router implements IRouter {
return;
}
gatewaySession.putAttribute(AttributeType.UID, uid);
EventBus.asyncSubmit(AuthUidToGatewayEvent.valueOf(gatewaySession.getSid(), uid));
EventBus.submit(AuthUidToGatewayEvent.valueOf(gatewaySession.getSid(), uid));
NetContext.getRouter().send(session, AuthUidToGatewayConfirm.valueOf(uid), new GatewayAttachment(gatewaySession, null));
return;
@@ -346,7 +346,7 @@ public class Router implements IRouter {
// 这个在哪个线程处理取决于:这个上层的PacketReceiverTask被丢到了哪个线程中
PacketBus.submit(session, packet, attachment);
} catch (Exception e) {
EventBus.syncSubmit(ServerExceptionEvent.valueOf(session, packet, attachment, e));
EventBus.submit(ServerExceptionEvent.valueOf(session, packet, attachment, e));
logger.error(StringUtils.format("e[uid:{}][sid:{}]未知exception异常", session.getAttribute(AttributeType.UID), session.getSid(), e.getMessage()), e);
} catch (Throwable t) {
logger.error(StringUtils.format("e[uid:{}][sid:{}]未知error错误", session.getAttribute(AttributeType.UID), session.getSid(), t.getMessage()), t);