[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [aspectj-users] aspectj configuration question
- From: Andy Clement <andrew.clement@xxxxxxxxx>
- Date: Fri, 22 Oct 2010 12:34:57 -0700
- Delivered-to: email@example.com
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=PIB35HCaIm0N5I0//HX2o+0RC5n8cgalBEvsPdy0BP4=; b=Xp78QSzkSJ6HrIslxAjhOMMxX6g5/iWS7OBB0kTxwN9gwUDJg3N9mBhqlACcWy7OYu NikG3ctEvW5IAM3js2C1jh2hIjwf15HZLYLzVGfkdotCJtcAtf+k1xQzoZ6vTqj5jfak YeB04ONht6oVA+9xARAcHgw6katwgoc4kLWD0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=cTV+6i+WdZ2rleyn4bAcDqA6bvN2SWYGL5l+tKDDFdHOdApPAhfIZViUTWRUIMhndp AsaYUyTa8nBdyuZ81l6GODr+BevRNzNF4/CJKzRUrux/ExP3ERLEsOEocss67hh/eKwD BbYxgfU6Qq+HBnybPbXj1Irlhg+yrz1xg6ZNk=
> 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:
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 ?