AspectJ连接点和线程安全

时间:2018-10-05 12:26:50

标签: java thread-safety aspectj

我在执行方法时有一个AspectJ切入点,如下所示,当调用该方法时,我正在读取参数并对其进行验证。声明该方法的类为 Singleton 。我的问题是 joinPoint.getThis() joinPoint.getArgs()是线程安全的。

@Before("atExecution() && customPointcut(customAnnotation)")
public void validate(JoinPoint joinPoint, CustomAnnotation customAnnotation)  {

    MethodSignature sig = (MethodSignature) joinPoint.getSignature();
    Method method =  sig.getMethod();

    ExecutableValidator execValidator = validator.forExecutables();

    //is this code thread safe?
    Set<ConstraintViolation<Object>> violations= execValidator.validateParameters(joinPoint.getThis(), method, joinPoint.getArgs());

}

0 个答案:

没有答案
相关问题