AOP管理多线程事物有什么思路吗?
目前想法时通过2个注解来注释主方法,和子方法。在用AOP来处理事物逻辑
@ManTransaction()
public void syncAnnotation(){
}
@SonTransaction()
public void syncAnnotation2(){}
但是遇到问题我需要在@ManTransaction注释的方法通过AOP设置3个变量。且需要在@SonTransaction()注释的方法中能取到这3个变量
```java
private CountDownLatch manLatch;
private CountDownLatch souLatch;
private AtomicBoolean rollback;
@Around("@annotation(com.example.mybaitsplus.aop.ManTransaction)")
public Object man(ProceedingJoinPoint joinPoint) throws Throwable {
// 在此处设置3个变量
return null;
}
@Around("@annotation(com.example.mybaitsplus.aop.SonTransaction)")
public Object sou(ProceedingJoinPoint joinPoint) throws Throwable {
// 这里需要能取到主任务设置的变量操作
return null;
}