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_r305385003
 
 

 ##########
 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:
   So in this situation, the origin globalTxId and localTxId should be empty 
here. Can you log some warning message if the globalTxId is not empty ?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to