Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Aspect in an EAR file

Yes, James is right, load time weaving can do the kinds of thing you
want to do but it will incur you a startup hit.

Using a javaagent each classloader in the system gets a weaver and
will use any aop.xml files it can 'reach' through its classpath to
configure itself.  So if one jar on that classpath defines an aop.xml
file containing an aspect, then that weaver associated with the
classloader will apply the aspect to everything loaded through that
same classloader.

Weaving will be about the same speed regardless of when you choose to
do it (compile time, post compile time, load time) but:
- load time weaving will weave things as they are loaded.  This may
sound obvious, but this does mean if something isn't loaded on a
particular run of the application then you won't weave it or incur the
cost of weaving it.  Whereas compile time weaving will weave
everything.
- beyond speed there is a memory overhead for a weaver that you will
incur.  But having said that we are including some basic caching in
the next version that will mean you can weave on first startup,
automatically store those woven entities, and then use the stored
cached versions on the subsequent starts. (reducing the memory and
performance impact).

Andy

On 18 May 2012 04:30, James Black <planiturthian@xxxxxxxxx> wrote:
> I don't see why you can't do this, but you will take a performance hit as it
> weaves at run time.
>
> It is best if you can apply the aspects during compilation, but if that
> isn't an option then run time is your other option.
>
> On May 18, 2012 6:10 AM, "jbolger" <john.bolger@xxxxxxxxx> wrote:
>>
>> Hi,
>>
>> Can you tell me if I can configure an aspect within an EAR to apply advice
>> against all code (including jars and wars) within the EAR and it's lib
>> (without having to define the aspect in each of the wars)?
>>
>> Also in this case, which weaving style is most appropriate? Is it even
>> possible to perform compile/post-compile time weaving for an EAR when the
>> jars / wars it includes have already been built?
>>
>> And finally, is any weaving style more performant than the other?
>>
>> Thanks in advance,
>> John
>>
>> --
>> View this message in context:
>> http://aspectj.2085585.n4.nabble.com/Aspect-in-an-EAR-file-tp4644307.html
>> Sent from the AspectJ - users mailing list archive at Nabble.com.
>> _______________________________________________
>> 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