Skip to main content

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

Hi Andrew,

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.

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. 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.

Could you elaborate on the 2nd approach? I am trying to weave only specific aspect to its specific class(es).

Regards,
- Yohan chandra -

On Wed, Oct 20, 2010 at 5:36 PM, Andrew Eisenberg <andrew@xxxxxxxxxxxx> wrote:
> 1. Will servicesA be woven with all the three aspects (aspectA,B,C)?
Correct.

> 2. If Yes, is there any way to configure specific aspect to weave only
> specific class(es), example: AspectA weaves only servicesA?

Not directly, but there are two suggestions:

1. Within each specific aspect, you can add a within() pointcut to
each of your advice declarations and this will ensure that AspectA is
only applied to ServiceA.  Eg, something like this:

pointcut canApplyTo() : within(ServiceA);

after() : doingSomethingAwesome() && canApplyTo() {
  ...
}

2. Separate each of your service and aspects into separate modules to
pair serviceA and aspectA, etc.

I'd strongly recommend #1.
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top