I have two advices matching the same pointcut. They are supposed to be performed one after another. For example:
pointcut som(TargetClass t, CallingClass c): target(t) && this(c) && call(public * TargetClass .*(..) );
before(TargetClass t, CallingClass c): som(t, c)
{
System.out.println("Entering: " + thisJoinPoint);
String identifier = <...>; //Generating unique identifier for a method call
getMonitor().addRecord(identifier, new Date()); //Sending new record to a custom monitor object
}
after(TargetClass t, CallingClass c): som(t, c) returning
{
getMonitor().finishRecord(identifier, new Date());
}
This is how I see the logic in general. The problem is how to make a variable created in the "before" advice available in the "after" advice. I do not know ApsectJ well enough to solve this problem.