[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] How to introduce a pointcut around wait() call ?
|
Radhakrishnan,
The implementation of both wait() and notify/notifyAll() methods is in
java.lang.Object so you cannot use execution advice. The following aspect
using call() advice works:
aspect TrapWait
{
void around() : call(public void *.wait()) && target(WaitAndNotify)
{
System.out.println("Trapped a wait() call");
proceed();
}
void around() : call(public void *.notifyAll()) && target(WaitAndNotify)
{
System.out.println("Trapped a notifyAll() call");
proceed();
}
void around(): execution(public void WaitAndNotify.simpleMethod())
{
System.out.println("Trapped a simpleMethod()");
proceed();
}
}
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/