|
From: Steven D. <ste...@gm...> - 2005-08-29 08:29:36
|
Lilantha,
After returning advice is indeed processed in the opposite order.
Since the method invocation moves back up the advisor chain the last
advisor is processed first, then the second to last and so on until
all advisors have been processed.
If you would chain an number of around advices (method interceptors)
they would also be processed in the inverse order once the target
method exits although they have been called in the expected order when
the method invocation starts.
Steven
On 8/29/05, Lilantha Darshana <Lil...@si...> wrote:
> =20
> =20
>=20
> Hi=20
>=20
> =20
>=20
> I'm trying a to invoke a joint point where I have two after returning
> advices that I need to execute=20
>=20
> In the order that I have specified in the config bean. My bean definition=
s
> is something like:=20
>=20
> =20
>=20
> <bean id=3D"test"
> class=3D"org.springframework.aop.framework.ProxyFactoryBean">
>=20
> <property
> name=3D"proxyInterfaces"><value>ITarget</value></property>=20
>=20
> <property name=3D"target"><ref local=3D"testTarget"/></property=
>=20
>=20
> <property name=3D"interceptorNames">=20
>=20
> <value>testAdvice1,testAdvice2</value>=20
>=20
> </property>=20
>=20
> </bean>=20
>=20
> <bean id=3D"testTarget" class=3D"Target"/>=20
>=20
> =20
>=20
> <bean id=3D"testAdvice1"
> class=3D"org.springframework.aop.support.RegexpMethodPointcutAdvisor">
>=20
> <property name=3D"advice">=20
>=20
> <bean class=3D"AfterAdvice1"/>=20
>=20
> </property>=20
>=20
> <property name=3D"patterns">=20
>=20
> <list>=20
>=20
> <value>.*foo</value>=20
>=20
> </list>=20
>=20
> </property>=20
>=20
> </bean>=20
>=20
> <bean id=3D"testTarget" class=3D"Target"/>=20
>=20
> =20
>=20
> <bean id=3D"testAdvice2"
> class=3D"org.springframework.aop.support.RegexpMethodPointcutAdvisor">
>=20
> <property name=3D"advice">=20
>=20
> <bean class=3D"AfterAdvice2"/>=20
>=20
> </property>=20
>=20
> <property name=3D"patterns">=20
>=20
> <list>=20
>=20
> <value>.*foo</value>=20
>=20
> </list>=20
>=20
> </property>=20
>=20
> </bean>=20
>=20
> =20
>=20
> My expectation is, after retuning from the join point it should execute
> return method of each of=20
>=20
> these after advices in the same order as I have specified in the bean.=20
>=20
> i.e. testAdvice1 followed by testAdvice2.=20
>=20
> =20
>=20
> However, it's executes them in opposite order. This seems due to followin=
g
> method of=20
>=20
> AfterReturningAdviceInterceptor class.=20
>=20
> =20
>=20
> public Object invoke(MethodInvocation mi) throws Throwable {=20
>=20
> Object retVal =3D mi.proceed();=20
>=20
> this.advice.afterReturning(retVal, mi.getMethod(),
> mi.getArguments(), mi.getThis());=20
>=20
> return retVal;=20
>=20
> }=20
>=20
> =20
>=20
> Appriciate if you would clarify why it is execute in opposite order? Is i=
t
> the intended way to execute them?=20
>=20
> =20
>=20
> Thanks=20
>=20
> -Lilantha=20
>=20
> _______________
> Siebel
> IT'S ALL ABOUT THE CUSTOMER
> Visit www.siebel.com
> =20
> This e-mail message is for the sole use of the intended recipient(s) and
> contains confidential and/or privileged information belonging to Siebel
> Systems, Inc. or its customers or partners. Any unauthorized review, use,
> copying, disclosure or distribution of this message is strictly prohibite=
d.
> If you are not an intended recipient of this message, please contact the
> sender by reply e-mail and destroy all soft and hard copies of the messag=
e
> and any attachments. Thank you for your cooperation.
> =20
--=20
"If you want to be a different fish, you gotta jump out of the school."
-- Captain Beefheart
|