as unlock() is throwing RecordNotFoundException, I'm checking if the given recNo is valid one (using record flag) before unlocking the record(removing this record entry from lock map).
my question is: since record 10 is already deleted. when the control reaches data.unlock(10,c), RecordNotFoundException would be thrown. is it okay ?? or should I change the code as to check record-valid after unlocking, i mean removing recordNo entry from lock map?.
Roel De Nijs wrote:My unlock-method does not contain any check to see if recNo is valid, because that makes no sense.
Makeshkumar, what you can do is verify if the record to be unlocked was locked (or, if it is in the structure that keeps the locked records - normally a Map<Long, Long>); if it wasn't, then you can throw IllegalStateException.