Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] notifyAll exception

Hi Irum -

As I imagine you know, notifyAll() must take place while the
object is synchronized, so perhaps:

(1) make sure the notifyAll() advice only runs in the 
control flow of the synchronized advice

(2) make sure the notifyAll() targets the right object (if you sync
on the stream, call notifyAll() on the stream, not the aspect)

   after(DurableObjectStream s) returning : writeObjectCut() 
           && target(s) { // && cflow(..)??
       s.notifyAll();
   }

(I'd be more concrete but I'm not entirely clear on your code.)

I hope this helps - 
Wes

------------Original Message------------
From: Irum Godil <softwarengineer2004@xxxxxxxxx>
To: "AJDT USER" <aspectj-users@xxxxxxxxxxx>
Date: Thu, Feb-3-2005 6:43 PM
Subject: [aspectj-users] notifyAll exception
Hi, 
I have a synchronized function which has a call to notifyAll. I want to put both the synchronized keyword and the call to notifyAll into an aspect. I have done the following: 

pointcut writeObjectExec(DurableOutputStream stream) : target(stream) &&
                                execution(int writeObject(Object) throws IOException);
 
int around(DurableOutputStream stream) : writeObjectExec(stream) {
      synchronized(stream) {
      return proceed(stream);      
  }
 }
This gets rid of the "synchronized" keyword. Now I do the following: 

pointcut writeObjectCut() : withincode(private int writeObject(Object) throws IOException)
 && within(DurableOutputStream) && set(int DurableOutputStream._objectsWritten);

after() : writeObjectCut() {
     notifyAll();
 }

However, I keep getting the exception "Current Thread not owner". The exception is happening around the "notifyAll" call. Can someone please help me as to what to do here?

Thanks.
Sincerely,
Irum Godil.


Do you Yahoo!?
The all-new My Yahoo! What will yours do? 




Back to the top