Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] WeavingAdapter - how to use it?

Hi,

Indeed I forgot :) And I did create a wrapper class around the WeavingAdaptor that sets the right permissions. The code is the following:

Please find attached the code.

It works brilliant as long as I don't instrument already loaded classes, through java.lang.Instrumentation.instrumentation.retransformClasses(...);
or java.* classes, I don't exactly know. In this case, Java complains about not finding the aspect. I am currently exploring the use of -Xbootclassptah/p:<path_to_aspect>.


Thanks for the replies.
Best regards,
Silviu

Attachment: LoadTimeSyncWeaver.java
Description: LoadTimeSyncWeaver.java

On Nov 21, 2009, at 10:10 PM, Andy Clement wrote:

Might have helped if you told me how your program didn't work....

I didn't realise you were using synchronization join points.  These
are not available without the appropriate weaver option being set.
Just to test your program I recreated the monitor aspect simply to
intercept execution join points and it worked just fine.

I can't recall if there is a way to specify options to the weaver like
that (-Xjoinpoints:synchronization) without using an aop.xml - have a
dig around to see if you can find it.  You may need to modify the
weavingadapter to expose the world so you can set that behaviour or
build some option processing in the adaptor for people coming in via
the same route as you.  If you make the change, I'll take a patch to
add it.

Andy.

2009/11/20 Andrica Silviu <silviu.andrica@xxxxxxx>:
Hello,

thank you for the replies!

On Nov 20, 2009, at 11:45 PM, Andy Clement wrote:

Hi,

I use my own agent, to perform other types of analysis on the bytecode. Thus I would like to use the load-time facilities offered
by AspectJ out of their normal context. I searched a bit and I found WeaverAdapter. However, what is not clear to me is how
to use it. Could someone point me to a tutorial, example, etc?

Unfortunately there is no real documentation on that.  You may find
some googling through the mailing list archives as a few people have
done it before, but it hasn't been formally written up due to lack of
time.  If anyone wants to help out fleshing out the details, the wiki
space on http://wiki.eclipse.org/AspectJ would be a great place to
document it...
I found such a question, with example code, but I wasn't able to instrument anything :(.

Please find attached the source code for my little experiment. I followed some guidelines I found in a previous mail sent to this list. However, it does not work for me.
I should mention I am using Java 6, with AspectJ 1.6.6

_______________________________________________
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