erenboss commented on issue #6744: URL: https://github.com/apache/incubator-seata/issues/6744#issuecomment-2285275584
> 通过xid去tc侧查看事务决议的时间是什么时候 Go to the tc side through xid to check when the transaction resolution is @Before("transactionPointcut()") public void before(JoinPoint joinPoint) throws TransactionException { String treadName = Thread.currentThread().getName(); MethodSignature signature = (MethodSignature) joinPoint.getSignature(); Method method = signature.getMethod(); // 此处可用redis或者定时任务来获取一个key判断是否需要关闭分布式事务 // 模拟动态关闭分布式事务 String fullMethodName = signature.getDeclaringTypeName() + "." + method.getName(); String methodName = method.getName(); if (isNeedDistributedTransaction(methodName,fullMethodName)) { log.debug("############# 分布式事务. xid:{};fullMethodName:{}", RootContext.getXID(), fullMethodName); if (StringUtils.isBlank(RootContext.getXID())) { GlobalTransaction tx = GlobalTransactionContext.getCurrentOrCreate(); log.debug("############# GlobalTransactionContext:{}", GlobalTransactionContext.getCurrentOrCreate()); tx.begin(180000, "GlobalTransaction:" + fullMethodName); log.debug("############# 开启分布式事务. xid:{};fullMethodName:{}", RootContext.getXID(), fullMethodName); CurrentUserInfo currentUserInfo = CurrentUserInfoHolder.get(); CurrentUserInfoHolder.get().setIsBeginSeataTransaction(true); } else { log.debug("############# 绑定分布式事务. xid:{};fullMethodName:{}", RootContext.getXID(), fullMethodName); CurrentUserInfo currentUserInfo = CurrentUserInfoHolder.get(); Boolean isBeginSeataTransaction = CurrentUserInfoHolder.get().getIsBeginSeataTransaction(); RootContext.bind(RootContext.getXID()); } } else { log.debug("############# 不开启分布式事务. fullMethodName:{}", fullMethodName); } } tx.begin(180000, "GlobalTransaction:" + fullMethodName); 我们是通过切面管理事务,在并发情况下,这里的name都是一样的,这里会有影响吗 GlobalTransaction.begin() -- 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