Now I only add lock/unlock to those methods which change the record value. But it has a problem:
While read the record from db file, does it need to add a reading lock on record?
If there hasn't a reading lock. while one client
thread is reading the record but another client thread changes the record. so the reading client maybe get two different results(before changed or after changed). I think this is not right. So, do I need to add lock to every method which accesses record (both read and write)?