@Override @Nullable public ClassLoader getAspectClassLoader() { return this.maaif.getAspectClassLoader(); }
@Override public Object getAspectInstance() { Object aspectInstance = this.materialized; if (aspectInstance == null) { Object mutex = this.maaif.getAspectCreationMutex(); if (mutex == null) { aspectInstance = this.maaif.getAspectInstance(); this.materialized = aspectInstance; } else { synchronized (mutex) { aspectInstance = this.materialized; if (aspectInstance == null) { aspectInstance = this.maaif.getAspectInstance(); this.materialized = aspectInstance; } } } } return aspectInstance; }
/** * Return the AspectJ AspectMetadata for this advisor. */ public AspectMetadata getAspectMetadata() { return this.aspectInstanceFactory.getAspectMetadata(); }
public SyntheticInstantiationAdvisor(final MetadataAwareAspectInstanceFactory aif) { super(aif.getAspectMetadata().getPerClausePointcut(), (MethodBeforeAdvice) (method, args, target) -> aif.getAspectInstance()); } }
@Override public int getOrder() { return this.maaif.getOrder(); }
@Override @Nullable public Object getAspectCreationMutex() { return this.maaif.getAspectCreationMutex(); }
public SyntheticInstantiationAdvisor(final MetadataAwareAspectInstanceFactory aif) { super(aif.getAspectMetadata().getPerClausePointcut(), (MethodBeforeAdvice) (method, args, target) -> aif.getAspectInstance()); } }
@Override public int getOrder() { return this.aspectInstanceFactory.getOrder(); }
@Override public Object getAspectCreationMutex() { return this.maaif.getAspectCreationMutex(); }
@Override public AspectMetadata getAspectMetadata() { return this.maaif.getAspectMetadata(); }
@Override public Object getAspectInstance() { if (this.materialized == null) { Object mutex = this.maaif.getAspectCreationMutex(); if (mutex == null) { this.materialized = this.maaif.getAspectInstance(); } else { synchronized (mutex) { if (this.materialized == null) { this.materialized = this.maaif.getAspectInstance(); } } } } return this.materialized; }
@Override public int getOrder() { return this.aspectInstanceFactory.getOrder(); }
@Override @Nullable public Object getAspectCreationMutex() { return this.maaif.getAspectCreationMutex(); }
@Override public ClassLoader getAspectClassLoader() { return this.maaif.getAspectClassLoader(); }
@Override @Nullable public Advisor getAdvisor(Method candidateAdviceMethod, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrderInAspect, String aspectName) { validate(aspectInstanceFactory.getAspectMetadata().getAspectClass()); AspectJExpressionPointcut expressionPointcut = getPointcut( candidateAdviceMethod, aspectInstanceFactory.getAspectMetadata().getAspectClass()); if (expressionPointcut == null) { return null; } return new InstantiationModelAwarePointcutAdvisorImpl(expressionPointcut, candidateAdviceMethod, this, aspectInstanceFactory, declarationOrderInAspect, aspectName); }
@Override public Object getAspectInstance() { Object aspectInstance = this.materialized; if (aspectInstance == null) { Object mutex = this.maaif.getAspectCreationMutex(); if (mutex == null) { aspectInstance = this.maaif.getAspectInstance(); this.materialized = aspectInstance; } else { synchronized (mutex) { aspectInstance = this.materialized; if (aspectInstance == null) { aspectInstance = this.maaif.getAspectInstance(); this.materialized = aspectInstance; } } } } return aspectInstance; }
@Override public int getOrder() { return this.aspectInstanceFactory.getOrder(); }
@Override @Nullable public ClassLoader getAspectClassLoader() { return this.maaif.getAspectClassLoader(); }
public InstantiationModelAwarePointcutAdvisorImpl(AspectJExpressionPointcut declaredPointcut, Method aspectJAdviceMethod, AspectJAdvisorFactory aspectJAdvisorFactory, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrder, String aspectName) { this.declaredPointcut = declaredPointcut; this.declaringClass = aspectJAdviceMethod.getDeclaringClass(); this.methodName = aspectJAdviceMethod.getName(); this.parameterTypes = aspectJAdviceMethod.getParameterTypes(); this.aspectJAdviceMethod = aspectJAdviceMethod; this.aspectJAdvisorFactory = aspectJAdvisorFactory; this.aspectInstanceFactory = aspectInstanceFactory; this.declarationOrder = declarationOrder; this.aspectName = aspectName; if (aspectInstanceFactory.getAspectMetadata().isLazilyInstantiated()) { // Static part of the pointcut is a lazy type. Pointcut preInstantiationPointcut = Pointcuts.union( aspectInstanceFactory.getAspectMetadata().getPerClausePointcut(), this.declaredPointcut); // Make it dynamic: must mutate from pre-instantiation to post-instantiation state. // If it's not a dynamic pointcut, it may be optimized out // by the Spring AOP infrastructure after the first evaluation. this.pointcut = new PerTargetInstantiationModelPointcut( this.declaredPointcut, preInstantiationPointcut, aspectInstanceFactory); this.lazy = true; } else { // A singleton aspect. this.pointcut = this.declaredPointcut; this.lazy = false; this.instantiatedAdvice = instantiateAdvice(this.declaredPointcut); } }
@Override public int getOrder() { return this.maaif.getOrder(); }