Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] pointcuts around the wait() call ?

You will need to use call() pointcut instead of execution()
for wait() and notifyAll().

-Ramnivas

--- Radhakrishnan J <radhakrishnan.j@xxxxxxxxxx> wrote:
> Hi,
> 
> I would like to define an aspect where I am able to monitor the
> occurrences
> of wait() calls. I tried doing this and found that this doesn't work.
> 
> 
> public class WaitAndNotify
> {
>   public void simpleMethod()
>   {
>    return;
>   }
> 
>   public synchronized void dummyWait()
>   {
>     this.wait();
>   }
> 
>   public synchronized void dummyNotify()
>   {
>    this.notifyAll();
>   }
> }
> 
> aspect TrapWait
> {
>   void around() : execution(public void *.wait() )
>   {
>     System.out.println("Trapped a wait() call");
>     proceed();
>   }
> 
>   void around() : execution(public void *.notifyAll() )
>   {
>     System.out.println("Trapped a notifyAll() call");
>     proceed();
>   }
> 
> 
>   void around(): execution(public void WaitAndNotify.simpleMethod())
>   {
>     System.out.println("Trapped a simpleMethod()");
>     proceed();
>   }     	
> }
> 
> I noticed that the advice gets executed for the method
> "simpleMethod()" but
> not for "wait()" or "notifyAll()" calls. Why is this so ?
> 
> Thanks,
> Radhakrishnan
> 
> 
> Radhakrishnan. J
> Tavant Technologies
> Work # +91-80-51190372
> Cell # +91-98860 48400
> 
> "Driving profit through channel collaboration"
> www.tavant.com
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users


__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus


Back to the top