[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] aspectj configuration question

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