Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Selective Load-Time Weaving with aop.xml and Java ClassLoader


Greg,

WRT your aj/aj5 problem it is difficult to tell what is going on without some more information. Which JDK are you using? What is the exact version of AspectJ? How are configuring aj: are you just using CLASSPATH or ASPECTPATH as well. I suggest you open a bug report and append the verbose output you have collected along with configuration details.

I would caution the use of  "<include within..." and "<exlude within..." as a general programming model, it was never intended to be used for that and can actually make your programs harder to understand. They were intended to be used by non-programmers managing complex systems comprising code from multiple sources as a way of dealing with potential problems. If you don't intend to weave a class or package then write a pointcut. I know you are not using Eclipse but at least you will get some feedback from the compiler in terms of where an aspect is taking affect rather than waiting until you run your program. If your were using Eclipse and AJDT then you could have immediate knowledge.

WRT performance we have not done a comparison between the 2 approaches but you have discovered something interesting. When you say "a few seconds slower" I assume that relates to startup time but what is it in terms of a percentage? Using JVMTI is a more general solution while the classloader-based approach will only attempt to weave CLASSPATH. It may be that we need to better optimize the case where we are not weaving. It may be that with recent enhancements that you will see an improvement in AspectJ 1.5.2 or if you take a DEVELOPMENT build.

Cheers

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx

http://w3.hursley.ibm.com/~websterm/

Please respond to aspectj-users@xxxxxxxxxxx

Sent by:        aspectj-users-bounces@xxxxxxxxxxx

To:        aspectj-users@xxxxxxxxxxx
cc:        
Subject:        [aspectj-users] Selective Load-Time Weaving with aop.xml and Java        ClassLoader


Hello,

I have read through the load time weaving information on the Web site
several times and scanned the mailing list for a post directly related
to the below issue.  However, I was unable to locate an answer to my
question.  

I have seen pointers to archives that might solve my problem but
appear to be customized for IntelliJ or different application
containers.  I would appreciate any assistance that you can provide.

I am using AspectJ 1.5 and the load-time weaving functionality
provided by both the aj and aj5 scripts.  The scripts are always
executed from the command line, I write all of the Java and AspectJ
code in emacs, and I have my own Ant build system that I run from the
command line.

I have written a simple aop.xml file that I include in the META-INF/
directory of the .jar file that contains just my aspects.  The weaver
section contains several includes so that the aspects are only applied
to those classes during load-time weaving.  

<weaver options="">
              <include within="org.hsqldb.sample.*"/>
              <include within="gradebook.*"/>
              <include within="com.runstate.pithy.*"/>
              <include within="reminder.*"/>
              <include within="student.*"/>
              <include within="TransactionAgent.*"/>
</weaver>

This works correctly when I use the aj5 script but it does not work
properly when I use the aj script.  For the aj script, all of the
classes that are loaded are also instrumented as revealed by the "info
weaving" output.  I produced this output by using the
-Daj.weaving.verbose=true flag.

My main question is: does load-time weaving with a classloader
recognize and support the aop.xml file?  Also, I have tried to turn
off the XLint debugging information in the aop.xml file and I seem
unable to do so.

Finally, my preliminary tests show that the JVMTI load-time weaving
approach is always a few seconds slower than the classloader-based
technique, even if the JVMTI agent selectively instruments the
classes.  I am measuring the execution of my test coverage monitoring
tool, written with AspectJ, using /usr/bin/time.

Have others also confirmed this trend?  Are there any other mechanisms
for improving the performance of load-time weaving?  Any comments or
advice on these issues would certainly be appreciated!

Kind Regards,

greg

--
Gregory M. Kapfhammer, Instructor
Department of Computer Science
Allegheny College
Office: 814-332-2880
gkapfham(at)allegheny(dot)edu
http://cs.allegheny.edu/~gkapfham/



----- End forwarded message -----

--
Gregory M. Kapfhammer, Instructor
Department of Computer Science
Allegheny College
Office: 814-332-2880
gkapfham(at)allegheny(dot)edu
http://cs.allegheny.edu/~gkapfham/

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top