db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raymond Raymond" <raymond_de...@hotmail.com>
Subject A question about some synchronized code.
Date Fri, 15 Dec 2006 16:06:43 GMT
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/


Mime
View raw message