public long lockRecord(long recNo) throws RecordNotFoundException
According lock method signature provided by Sun, it throws RNFE, if I don't want to check invalid record and discard RNFE in my implementation, is it OK?
Thank you, Surasak
posted 11 years ago
I can think of one good reason why you should throw the RecordNotFoundException from lockRecord: A client may in the future want to lock a record down indefinitely, without calling any other methods on the data object before or after locking. This might happen if a subcontractor was suspended and could not be used for a while. In this case, all the client would want to do is call the lockRecord method, which is public. The client could not count on discovering that a record did not exist by calling other methods like readRecord because all the client wants to do is lock the record. Thus, the client should be made aware that a record does not exist if it tries to lock a record, and hence the RecordNotFoundException should be thrown in lockRecord.