JBoss Community

FieldWriteInvocation.getValue does not reflecting changes made along interceptors

created by Rick Dong in JBoss AOP - View the full discussion

I have two field write interceptors A and B that is instrumented on a particular fileld. A gets invoked before B. Can someone please confirm whether the following should work?

{code}

A extends Interceptor

{

    public final Object invoke(Invocation invocation) throws Throwable
    {
        if (invocation instanceof FieldWriteInvocation)
        {
            FieldWriteInvocation fwi = (FieldWriteInvocation)invocation;

            Integer value = fwi.getValue(); //value here is 1 suppose

 

            fwi.setValue(2); //change the value
        }
        return invocation.invokeNext();

}

 

after A is done, B is invoked

 

B extends Interceptor

{

    public final Object invoke(Invocation invocation) throws Throwable
     {
         if (invocation instanceof FieldWriteInvocation)
         {
             FieldWriteInvocation fwi = (FieldWriteInvocation)invocation;

            Integer value = fwi.getValue(); //value here should've been 2, but still is 1 (bug??)
         }
         return invocation.invokeNext();

}

{code}

Reply to this message by going to Community

Start a new discussion in JBoss AOP at Community