Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Advice on Advice

Again, my apologies. I cannot simply copy and paste the code in here.
I will take some time to write up something in github that exhibits
the same behaviour, but this may take a while :) I was hoping perhaps
there is something obvious I missed, with respect to logging or
advice, something I don't understand. Thank you for the help
nonetheless. I will get back to you with a more concrete example.

On Tue, Mar 12, 2013 at 1:03 PM, Alexander Kriegisch
<Alexander@xxxxxxxxxxxxxx> wrote:
> LOL, now you are asking us to help you with your pointcut and advice which still you have not provided. Sorry, I really wanted to help, but I like you to make it a bit easier for me to help by not letting me guess what might be the problem, but verify hard facts. Can you provide something I can actually compile and run?
>
> Alexander Kriegisch
>
> Am 12.03.2013 um 11:34 schrieb Jaco le Roux <jabalsad@xxxxxxxxx>:
>
>> Apologies. It was 1:30am and I think my brain turned to jelly after a
>> long day of doing computery things :)
>>
>> Here is a sample aspect I am building:
>>
>> @Aspect
>> @Configurable
>> public class MyAspect {
>>    private static final Log log = LogFactory.getClass(MyAspect.class);
>>    // Autowired dependencies
>>
>>    // Pointcuts and advice
>>
>>    // Happens to be a pointcut of some other Advice
>>    @Asynchronous
>>    private Object someMethod(...) {
>>    }
>> }
>>
>> My package depends on another library that defines an Aspect which
>> cuts across methods annotated with @Asynchronous. Therefore, during
>> ajc compilation, I would expect to see a message similar to this:
>> "weaveinfo Join point 'method-call(java.lang.Object
>> mypackage.someMethod(...))' in Type 'mypackage.MyAspect'
>> (MyAspect.java:30) advised by around advice from
>> 'anotherpackage.AsynchronousAspect' (from AsynchronousAspect.java))"
>>
>> But... I don't. The fun part is that when I add a simple log line to
>> my @Around advice in the MyAspect class, then the ajc compiler picks
>> up the @Asynchronous aspect and weaves it correctly. Why would adding
>> a simple thing like logging change my assumptions?
>>
>> On Tue, Mar 12, 2013 at 12:05 PM, Alexander Kriegisch
>> <Alexander@xxxxxxxxxxxxxx> wrote:
>>> Would you mind providing some minimal sample code to reproduce the situation? It is always a good idea to provide the code you ask others to help you fix. ;-)
>>>
>>> Alexander Kriegisch
>>>
>>>
>>> Am 12.03.2013 um 00:23 schrieb Jaco le Roux <jabalsad@xxxxxxxxx>:
>>>
>>>> Hi,
>>>>
>>>> I have an Advice class that declares a method that happens to be a
>>>> pointcut for other advice. My advice class also has a reference to a
>>>> static log object. If I print something to the log as part of some
>>>> @Around advice, the point-cuts are all setup correctly. If I comment
>>>> this line out, then the method that is a point-cut of the other advice
>>>> is no longer weaved during compile time (the log message "weaveinfo
>>>> Join point 'method-call(...)' in type '..' advised by around advice"
>>>> no longer appears).
>>>>
>>>> Why is that my advice doesn't trigger when I don't print to this log
>>>> file? Does it have to do with the fact that the log object is static
>>>> and perhaps forces the Aspect class to be instantiated at a different
>>>> point?
>>>>
>>>> Any advice (excuse the pun) appreciated!
>>>> _______________________________________________
>>>> aspectj-users mailing list
>>>> aspectj-users@xxxxxxxxxxx
>>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>> _______________________________________________
>>> aspectj-users mailing list
>>> aspectj-users@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top