Thanks for the answer, I will try the aspect scoping mechanism as mentioned.


One question: Suppose If i have multiple classes in scope for an aspect, how
would i define it?

Will I have to define it twice?
<aspect name="A" scope="com.foo.A">
<aspect name="A" scope="org.x.B">

or does scope have any delimiter? comma for example:
<aspect name="A" scope="com.foo.A, org.x.B">

Regards,
- yohan chandra -

On Fri, Oct 22, 2010 at 2:34 PM, Andy Clement <andrew.clem...@gmail.com>wrote:

> Few points:
>
> > 2.is there any way to configure specific aspect to weave only specific
> class(es), example: AspectA weaves only servicesA?
>
> You can do this actually, in the XML.  See the AOP Scoping section in
> the 1.6.9 readme:
> http://www.eclipse.org/aspectj/doc/released/README-169.html
>
> The options Andrew referenced are actually on by default for loadtime
> weaving, they are only experimental (and so you have to actively turn
> them on) if you are working in AJDT with compile time weaving.
>
> > Thanks for the answer. I actually have applied the 1st approach, the
> pointcuts and advices defined in aspectA
> > are applied to serviceA only and it's working well. However the issue is
> with memory I believe even though only
> > specific pointcut is applied, the class has been woven by other unrelated
> aspects and this consumes memory.
> > I monitored my app and I noticed a large increase of memory usage since
> AspectJ got implemented. I took the
> > heap dump and significant portion of it are AspectJ related instances.
>
> The classes wont be woven by other unrelated aspects unless they
> matched the classes in some way.
>
> > My app has lots of aspects and lots of "include within" classes. As I
> watch from the log, each of this "include
> > within" class is woven with number of aspects that I have, even though
> only specific aspect will be applied
> > later by the pointcut.
>
> Perhaps you mean 'matched' rather than 'woven'?  Every class will be
> matched against every aspect, but only those that match the type will
> affect it.  If you are seeing aspects that don't match a type being
> woven into it, that would be an AspectJ bug?
>
> > Suppose If i have 20 aspects and 30 "include within" classes the total
> number will be 600. I am trying to
> > reduce the memory usage of my AspectJ implementation as much as i can so
> it can go into production
> > but currently I am blocked.
>
> Yes, 20 aspects, 30 classes.  each class will be matched against all
> 20 aspects, but if your pointcuts dont match it, the type will not be
> woven by an aspect.
>
> How about just trying the aop scoping mechanism I mentioned ?
>
> Andy
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@eclipse.org
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to