> 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?
I'm not sure what problems that could be. When returning from a
synchronized block, the monitor is released (unless the thread already
owned the monitor when it entered the synchronized block). Do you have
a pointer to that discussion?
--
Knut Anders
Thanks for you answer Knut.
In org.apache.derby.impl.store.raw.log.LogToFile.java,
in method checkpointWithTran(), there is a piece of code
like following:
synchronized (this){
// has someone else found a problem in the raw store?
if (corrupt != null){
throw
StandardException.newException(SQLState.LOG_STORE_CORRUPT, corrupt);
}
// if another checkpoint is in progress, don't do anything
if (inCheckpoint == true)
proceed = false;
else
inCheckpoint = true;
approxLogLength = endPosition; // current end position
// don't return from inside of a sync block
}
if (!proceed){
return false;
}
see, someone did comment "don't return from inside of a sync block", I am
not
sure who wrote the comment. I am just wondering what potential problem it
will case to return from the inside of a sync 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/