Skip to main content

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

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



Back to the top