Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Regarding queuing methods using AspectJ

Hello all,

What started with as a simple idea is turning out more confusing than
I initially thought (or I am making it that way for myself)

What I am trying to achieve is a transaction queue which is executed
only when a particular method is called.

Currently I have a bunch of pointcuts identifying methods which I want
to capture and prevent execution till the 'trigger' method is called.
So, my pseudo algorithm
was something like this:

In the following, myMethodA, myMethodB are the target methods that I
want to queue and myMethodC is the trigger method.

===================
pointcut A: execution (myMethodA)

void around(): A()
 {
  Add the methodCall(joinpointSignature) to an ArrayList();
// I don't want to proceed with the execution of the method right now
 }

pointcut B: execution (myMethodB)

void around() : B()
 {
 Add the methodCall to the above ArrayList();
 }

pointcut C: execution (myMethodC)

void around(): C()
{

Execute myMethodA();
Execute myMethodB();
}

===================
I am able to save the method information using reflection, but I am
not sure how to make a call in the advice of myMethodC to execute
myMethodA() and myMethodB() from within the aspect.

Is there some way of saving the state of these methods and then
executing them? Perhaps there is a simpler way and I am just not aware
of it?

I appreciate any ideas or advice in this regards.

Thanks,

Sarthak


Back to the top