Today, when I read the source code of org.apache.derby.impl.store.raw.data.CachedPage.java,
I found some synchronized code like:

public boolean isDirty()    {
   synchronized (this)  {
       return isDirty || preDirty;
   }
}

public boolean isActuallyDirty() {
   synchronized (this) {
       return isDirty;
   }
}

I have two questions about them, hope someone can answer me:
1. Is it necessary to synchronize the code in these places?
2. I saw someone else commented on some code (in derby) said it's not
good to return from inside of a synchronized block. What potential problem
   it will cause if return from inside of a synchronized block?


Raymond

_________________________________________________________________
Off to school, going on a trip, or moving? Windows Live (MSN) Messenger lets you stay in touch with friends and family wherever you go. Click here to find out how to sign up! http://www.telusmobility.com/msnxbox/

Reply via email to