You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2019/07/19 13:35:12 UTC

[GitHub] [servicecomb-pack] zhfeng commented on a change in pull request #506: SCB-1385 provide a common way to pass the GID and LID

zhfeng commented on a change in pull request #506: SCB-1385 provide a common way to pass the GID and LID
URL: https://github.com/apache/servicecomb-pack/pull/506#discussion_r305358056
 
 

 ##########
 File path: omega/omega-transaction/src/main/java/org/apache/servicecomb/pack/omega/transaction/TransactionAspect.java
 ##########
 @@ -46,6 +48,15 @@ public TransactionAspect(SagaMessageSender sender, OmegaContext context) {
   @Around("execution(@org.apache.servicecomb.pack.omega.transaction.annotations.Compensable * *(..)) && @annotation(compensable)")
   Object advise(ProceedingJoinPoint joinPoint, Compensable compensable) throws Throwable {
     Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
+    // just check if we need to setup the transaction context information first
+    TransactionContext transactionContext = getTransactionContextFromArgs(joinPoint.getArgs());
+    if (transactionContext != null) {
+      LOG.debug("Updated context {} for globalTxId:{} and localTxId:{}", context,
+          transactionContext.globalTxId(), transactionContext.localTxId());
+      context.setGlobalTxId(transactionContext.globalTxId());
+      context.setLocalTxId(transactionContext.localTxId());
+    }
 
 Review comment:
   It could be better to restore the origin globalTxId and localTxId if they exists.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services