[aspectc-user] Re: pointcut with parameters and cflowbelow

Olaf Spinczyk olaf at ivs.cs.uni-magdeburg.de
Fri Jan 4 12:08:28 CET 2002


Hi,

On Thursday,  3. January 2002 23:26, you wrote:
> Sorry I made a (small) but important typo mistake:
> It should be:
>
> Object advicableHelperMethod(JoinPoint thisJP){
>     someCode();
>     Object obj=thisJP.proceed();
>     someOtherCode(obj);
>     return obj;
> }

This is an idea that we also had in an internal AspectC++ 
(http://www.aspectc.org/) design discussion a few weeks ago. In our 
vocabulary we use the word "action" for the control flow that is postponed 
when a join point is reached but advice is executed first (is there already a 
widely-known term for this?). What this "action" is doing depends on the kind 
of join point. It can be setting or getting an attribute or the execution of 
method.
If you allow advice to access the "action" as an object through thisJoinPoint 
you could easily implement "proceed()" by triggering the "action". This is 
similar to Arno Schmidmeier's code fragment above.

thisJoinPoint.action ().trigger ();  // proceed ()

We believe that action objects have many more applications than the 
reimplementation of proceed(). Think of reusable aspects that reorder the 
execution of functions (e.g. with the elevator algorithm), cache the results 
of calls to idempotent functions, execute actions more than once 
asynchronously to achieve fault tolerance in a distributed system, ...

I am not a Java expert but I expect that the Java Reflection API already 
allows to implement this kind of aspect. At least for methods it is possible 
to store a reference together with the arguments in an object and invoke it 
at any time.

Did anybody ever implement one of these aspects with AspectJ? Would that be 
interesting for you? Did the AspectJ designers ever think about "action 
objects"?

Regards,

Olaf

-- 
Dipl. Inform. Olaf Spinczyk                      | University of Magdeburg
E-mail: olaf at ivs.cs.uni-magdeburg.de             | Universitätsplatz 2
URL: http://www-ivs.cs.uni-magdeburg.de/~olaf    | 39106 Magdeburg
Phone: +49 391 67 12448                          | Germany


More information about the aspectc-user mailing list