@Around("execution(@org.apache.servicecomb.saga.omega.context.annotations.SagaStart * *(..)) && @annotation(sagaStart)")
Object advise(ProceedingJoinPoint joinPoint, SagaStart sagaStart) throws Throwable {
initializeOmegaContext();
Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
sagaStartAnnotationProcessor.preIntercept(context.globalTxId(), method.toString(), sagaStart.timeout(), "", 0);
LOG.debug("Initialized context {} before execution of method {}", context, method.toString());
try {
Object result = joinPoint.proceed();
sagaStartAnnotationProcessor.postIntercept(context.globalTxId(), method.toString());
LOG.debug("Transaction with context {} has finished.", context);
return result;
} catch (Throwable throwable) {
if (!(throwable instanceof OmegaException)) {
sagaStartAnnotationProcessor.onError(context.globalTxId(), method.toString(), throwable);
LOG.error("Transaction {} failed.", context.globalTxId());
}
throw throwable;
} finally {
context.clear();
}
}