Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Pointcut and Advice Question

I am working on an aspect oriented solution to providing forensics on class loading within Tomcat. The advice, aspect, and aop.xml are packaged in a jar which is loaded using -Xbootclasspath\a: (appends to the BCL path). I'm having problems with the pointcut and advice expressions matching the need within classloader behavior.

method is described here

What I need is a call pointcut that returns Class from ClassLoader+

pointcut source(String s, ClassLoader l) :
        target(ClassLoader+) &&
        target(l) &&
        args(s) &&
        call(Class loadClass(String));

The advice I'm having problem with is when an ClassNotFoundException (cnfe) is thrown, I'm only interested in the cases where delegation wasn't involved.  That is if a child delegates to the parent, a cnfe signals to the child to load if able.  If the leaf descendant throws cnfe, it means "really, class not found". So is this type of _expression_ normally best placed in the poincut, or the advice?

after(String s, ClassLoader l) throwing (ClassNotFoundException e) : source(s, l) {
    // do something here...
}

isn't selective enough, as I'm getting many cnfe's related to delegates responding to children to signal load should be attempted.  I played with cflow expressions but couldn't seem to come up with the proper invocation for the compiler.

Any help greatly appreciated.

CW









Back to the top