in omega/omega-transaction/src/main/java/org/apache/servicecomb/pack/omega/transaction/wrapper/SagaStartAnnotationProcessorWrapper.java [41:65]
public Object apply(ProceedingJoinPoint joinPoint, SagaStart sagaStart, OmegaContext context)
throws Throwable {
Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
sagaStartAnnotationProcessor.preIntercept(sagaStart.timeout());
LOG.debug("Initialized context {} before execution of method {}", context, method.toString());
try {
Object result = joinPoint.proceed();
if (sagaStart.autoClose()) {
sagaStartAnnotationProcessor.postIntercept(context.globalTxId());
LOG.debug("Transaction with context {} has finished.", context);
} else {
LOG.debug("Transaction with context {} is not finished in the SagaStarted annotated method.", context);
}
return result;
} catch (Throwable throwable) {
// We don't need to handle the OmegaException here
if (!(throwable instanceof OmegaException)) {
sagaStartAnnotationProcessor.onError(method.toString(), throwable);
LOG.error("Transaction {} failed.", context.globalTxId());
}
throw throwable;
} finally {
context.clear();
}
}