Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] How to lauch aspectjweaver at runtime?

Hi Simone,

You can have the benefit worlds by using a hybrid approach which we have implemented in our distribution of AspectJ weaver javaagent - without any code changes to AspectJ itself.

The first time an application starts up we use load-time weaving the second time we use a previously cached version which basically switches into binary/build weaving mode. The benefit here is that can you very easily remove all aspectj instrumentation without requiring any new build of the application. We have also added advanced filtering capabilities and diagnostics into the distribution which gives you even more control over the class visibility for aspects.

The result is that start up times are very fast and the memory footprint is significantly reduced as the weaver only ever sees the first class per classloader loaded into the JVM.

William

From: Simone Gianni [mailto:simoneg@xxxxxxxxxx]
Sent: Wednesday, June 16, 2010 4:07 AM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] How to lauch aspectjweaver at runtime?



Hi Santhosh,
you have two options:
- control the class loading of your servlets and use one of the weaving classloaders provided by AspectJ.
- weave all the JARs and the classes in your WAR at build time, and deploy a WAR with aspects already weaved in, using ajc (command line, ant task, or maven plugin), and the inpath option.

I prefer the second option :
- taking control of classloading in a JEE environment is never a "good thing"
- the weaver has a memory footprint, it is not important during build, but can be during runtime
- the weaver introduces a startup delay (cause classes are weaved while loaded), from something monolithic like a WAR it's better to spend that time during the build than at each deploy of the webapp


Simone

2010/6/15 Santhosh Thatipally <HYPERLINK "mailto:santhosh.thatipally@xxxxxxxxxx"santhosh.thatipally@xxxxxxxxxx>

We are using the aspjectJ 1.6.8 version and currently we are launching it using the JVM -javaagent option.



How we can launch the aspect weaver at runtime? Like from a servlet.



Thanks,

Santhosh





Back to the top