liuzh
Aug 30th, 2004, 04:13 AM
Hi,
I am using AOP to implement a caching mechanism. I have an adivsor that extends org.aopalliance.intercept.MethodInterceptor and do some checking. If the cache is up to date, I will return the cached copy and methodInvocation.proceed() will NOT be called. If the cache is outdated, methodInvocation.proceed() will be called and after the calling, the result will be cached.
However, by skipping methodInvocation.proceed(), the adivsors that appear after my advisor in the adivsorchain will not be invoked, either. This sounds like my advisor is not very well behaved.
Any suggestion? Is there any way in Spring AOP to signal that the final method invocation to be skipped while keeping the chain running till the end. (I can immediately see a conflict if one adivsor says skip and another says not to skip)
Or am I misusing AOP?
Thanks
Zehua
I am using AOP to implement a caching mechanism. I have an adivsor that extends org.aopalliance.intercept.MethodInterceptor and do some checking. If the cache is up to date, I will return the cached copy and methodInvocation.proceed() will NOT be called. If the cache is outdated, methodInvocation.proceed() will be called and after the calling, the result will be cached.
However, by skipping methodInvocation.proceed(), the adivsors that appear after my advisor in the adivsorchain will not be invoked, either. This sounds like my advisor is not very well behaved.
Any suggestion? Is there any way in Spring AOP to signal that the final method invocation to be skipped while keeping the chain running till the end. (I can immediately see a conflict if one adivsor says skip and another says not to skip)
Or am I misusing AOP?
Thanks
Zehua