Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] if and loop pointcuts

Hi Gregory,

Is is possible to define a point in terms of its requests on other
objects. The lock example is good here as I believe it would be
illustrate the need to be able to define a pointcut in terms of the what
pointcuts are activated inside of its execution. So I would like to have
an around() advice declared on a pointcut definition that is based on
whether an another poincut is weaved into its execution. 

Is this possible with the current language constructs? Have I missed
sometime in the documentation that details how to do this?

1. define pointcut for lock accesses (creation, acquire....)
2. define pointcut for all methods whch have pointcut (1) weaved into
them
3. create advice based on around(0 for pointcut (2)

Thoughts? Of course I would look at simply refactoring th code in the
first place. The more I use aspects they more I am drawn to fix other
peoples bad designs and code via the less cool and boring source code.

Regards,

William Louth
JDBInsight Product Architect
www.jinspired.com


-----Original Message-----
From: Gregor Kiczales [mailto:gregor@xxxxxxxxx] 
Sent: Wednesday, August 13, 2003 7:16 PM
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] if and loop pointcuts



> No, I want to have an aspect that takes a lock at the
> first access to a 
> variable (this is easy to detect) and releases the lock after 
> the last access to 
> that variable (and here comes my problem).

Before thinking about this more, I want to ask why you don't want to do
the simpler thing of just releasing the lock when the enclosing method
terminates? It seems to me that you'll have a lot of overhead for
counting gets/sets and figuring out which path you are on. While I can
see that minimizing the locking window is good, I wonder if you'll be
paying so much for it that it won't be worth it.

I see some other issues, but I wanted to ask this question first, before
trying to think about those other issues.


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top