Hi Elena and Ali,
Ali said:
I dont think you needto do either of these two (can be nice to have though).
Third option: It is more important to do this check after the while statement (just before trying to lock the record).
I think it's
also important to check whether the record exists before entering the synchronized block. Why to wait for the
lockedRecords monitor if the record does not exist?
Alex (SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJD 1.4)