I've been running my application in jboss-4.2.0.CR1 and i've been seeing some
really odd behavior with the aop system. Sometimes my pointcuts won't get
picked up..i change nothing...i touch nothing..i just restart the server and
bam! it works the next time.
Anyway trying to test this stuff to figure out what the problem is I noticed
something in my test case. From my previous post I was getting this output
which is wrong...
| ...
| cInstance.toString()=null
| cInstance.getMyField()=Invoked testcase.MyMethodInterceptor on testcase.C
method getMyField
| cInstance.myField=Invoked testcase.MyFieldInterceptor on testcase.C field
myField
| cInstance.cInstance.getClass().getMethod("getMyField",new
Class[0]).getName()=getMyField
| dInstance.toString()=Invoked testcase.MyFieldInterceptor on testcase.D
field myField
| dInstance.getMyField()=Invoked testcase.MyMethodInterceptor on testcase.D
method getMyField
| dInstance.myField=Invoked testcase.MyFieldInterceptor on testcase.D field
myField
| dInstance.cInstance.getClass().getMethod("getMyField",new
Class[0]).getName()=getMyField
| ...
|
As i said cInstance.toString() should not result in null because my interceptor
should return a value but it doens't. Ok so I added another protected annotated
field to the C class called myOtherField. Now checkout the output of
cInstance.toString()...
| cInstance.toString()=Invoked testcase.MyFieldInterceptor on testcase.C
field myField
| cInstance.getMyField()=Invoked testcase.MyMethodInterceptor on testcase.C
method getMyField
| cInstance.myField=Invoked testcase.MyFieldInterceptor on testcase.C field
myField
| cInstance.myOtherField=Invoked testcase.MyFieldInterceptor on testcase.C
field myOtherField
| cInstance.cInstance.getClass().getMethod("getMyField",new
Class[0]).getName()=getMyField
| dInstance.toString()=Invoked testcase.MyFieldInterceptor on testcase.D
field myField
| dInstance.getMyField()=Invoked testcase.MyMethodInterceptor on testcase.D
method getMyField
| dInstance.myField=Invoked testcase.MyFieldInterceptor on testcase.D field
myField
| dInstance.myOtherField=Invoked testcase.MyFieldInterceptor on testcase.D
field myOtherField
| dInstance.cInstance.getClass().getMethod("getMyField",new
Class[0]).getName()=getMyField
|
Suddenly the interceptor is run on the inherited myField attribute for C. It's
almost like the aop system doens't see any direct annotations in the C class so
it doesn't bother applying any aspects but if there is an annotation in C then
it will also take the time to look for any inherited fields that may be
annotated.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026336#4026336
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026336
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user