Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] percflow and recursion

Another thing that is sometimes appropriate is to make a percflow aspect that is based on a top-level join point (i.e., percflow(pc() && !cflowbelow(pc()))). This gives a common place to hang all the state for any top-level cflow that will always be accessible within the cflow. 

But it won't help you if you really want to instantiate a new aspect (e.g., to hold state) for each recursive entry.

Another approach is to use a static ThreadLocal in the aspect (e.g., to hold the Stack that Matthew suggests).

Ron Bodkin
Chief Technology Officer
New Aspects of Software
o: (415) 824-4690
m: (415) 509-2895


> ------------Original Message------------
> From: Matthew Webster <matthew_webster@xxxxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Wed, Sep-29-2004 2:36 AM
> Subject: Re: [aspectj-users] percflow and recursion
>
> 
> 
> 
> 
> Doug,
> 
> No, not directly although you could use a static Stack declared in the
> aspect onto which you push/pop instances. However are you getting the
> behaviour you desire? By choosing a joint point outside of the 
> recursion
> you will get a single aspect instance.
> 
> Matthew Webster
> AOSD Project
> Java Technology Centre, MP146
> IBM Hursley Park, Winchester,  SO21 2JN, England
> Telephone: +44 196 2816139 (external) 246139 (internal)
> Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
> http://w3.hursley.ibm.com/~websterm/
> 
> 
> Doug Orleans <dougo@xxxxxxxxx>@eclipse.org on 29/09/2004 03:59:42
> 
> Please respond to aspectj-users@xxxxxxxxxxx
> 
> Sent by:    aspectj-users-admin@xxxxxxxxxxx
> 
> 
> To:    aspectj-users@xxxxxxxxxxx
> cc:
> Subject:    [aspectj-users] percflow and recursion
> 
> 
> When an aspect is declared with percflow(p), aspectOf() returns the
> aspect instance associated with the current control flow; if the
> pointcut p includes join points in its own control flow, e.g. for a
> recursive method, the most recent aspect instance is returned.
> My question: is there any way to access the other aspect instances,
> i.e. for join points further up the stack?
> 
> --dougo@xxxxxxxxx
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> 
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> 



Back to the top