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

_________________________________________________________________
Enter the "Telus Mobility Xbox a Day" contest for your chance to WIN! Telus Mobility is giving away an Microsoft Xbox® 360 every day from November 20 to December 31, 2006! Just download Windows Live (MSN) Messenger to your IM-capable TELUS mobile phone, and you could be a winner! http://www.telusmobility.com/msnxbox/

Reply via email to