funky-eyes commented on code in PR #4475: URL: https://github.com/apache/incubator-seata/pull/4475#discussion_r1104157397
########## core/src/main/java/io/seata/core/rpc/netty/AbstractNettyRemotingServer.java: ########## @@ -198,6 +206,11 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception { private void handleDisconnect(ChannelHandlerContext ctx) { final String ipAndPort = NetUtil.toStringAddress(ctx.channel().remoteAddress()); RpcContext rpcContext = ChannelManager.getContextFromIdentified(ctx.channel()); + NettyPoolKey.TransactionRole channelRole = ChannelManager.getRoleFromChannel(ctx.channel()); + if (ENABLE_ROLLBACK_WHEN_DISCONNECT && NettyPoolKey.TransactionRole.TMROLE == channelRole) { + Set<String> needRollBackXids = rpcContext.getBeginXidCache().asMap().keySet(); + needRollBackXids.forEach(xid -> doGlobalRollBack(ctx,xid)); Review Comment: 用并行流回滚或者CompletableFuture去跑,用CompletableFuture好点,感觉这里可以不需要关心二阶段执行结果,因为也不可能去重试它,只是尝试提前回滚 Use parallel streams to rollback or run with CompletableFuture. Using CompletableFuture seems better. I think we don't need to care about the execution result of the second phase here, because it's impossible to retry it, just trying to rollback in advance. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For additional commands, e-mail: notifications-h...@seata.apache.org