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

> 
> Diana (et. al.),
> 
> While working on the language, we had an idea for a
> pointcut called
> enclosingexecution. The idea was that it was a kind
> of "backwards"
> withincode. It went from things in the body of the
> method to the
> method execution join point.  So, for example, 
> 
>   enclosingexecution(set(* Resource.*))
> 
> would be the execution join points of any method
> that lexically included
> sets to fields of Resource objects.  (You could of
> course replace the set
> pointcut with any other pointcut.)
> 
> The idea was that enclosing execution would be
> useful exactly for the
> kind of case you have. We could say "if a method
> writes an object, then
> lock it around the entire method body".
> 
> But we never could see how to get it to work right.
> The problem was that
> it was hard to believe that anything like:
> 
>  pointcut lockPoints(Foo o):
> enclosingExecution(set(<something>));
> 
>  before(Foo o): lockPoints(o) { lockIt(o); }
>  after (Foo o): lockPoints(o) { unlockIt(o); }
> 
> would be right very often. What about cases where
> the right place to
> lock is actually higher up in the call chain?  How
> does that get
> managed?
> 
> As I recall, that's why we stopped working on
> enclosingexecution. But
> I'm not sure enclosingexecution is actually a bad
> idea. It may just be
> that it needs more work than we had time to do. Or
> it *may* need a kind
> of transitive closure or hoist pointcut, and that
> *may* not be tractable.
> 
> So that's why I think your example is interesting.
> If you have an
> example where you can automatically add optimized
> locking, based
> just on knowing where set/get joinpoints are, then
> it could be input
> to trying to get something like enclosingexecution
> to work.

    I think in any method (of state changing type) 
where get/set of fields occurs, locking can be added
in the form I mentioned.Thus, before the first
(get/set) access to a variable the lock is taken, and
after the last access the lock is released.
  What you mention would help me, I think. Of course,
if there is a way to look for get/sets inside if or
loop statements (of course, if a method code does not
contain ifs or loops, then there is no problem).  
 
> Maybe anyways. Some others may be more skeptical
> that anything like
> enclosingexecution could work.
> 
> What's the status of your example now?

       My example is in the form it was last time. I
have given a number(say, 5) of accesses to a variable.
After I increment (in an after advice related to a
get/set pointcut or that variable) a counter, I test
if it is equal to 5. If it is then I release the lock.
My example does not contain ifs or loops where a
variable is accessed. So I do not have problems with
determining the exact number of accesses. However, I
want to be able to include the synchronization clauses
in more general applications.


              Thanks for the help,
                Diana.
     
 
         Thanks fo

________________________________________________________________________
Want to chat instantly with your online friends?  Get the FREE Yahoo!
Messenger http://uk.messenger.yahoo.com/


Back to the top