Hi,
somehow I do not really check why the implemented CleanExit class ensures file consistency.
After some redirections it uses
to ensure no other
thread can modify
recordNumbers which would be the case in write operations.
However, the writing operations unlock
recordNumbersLock after updating the recordNumbers but
before actually writing to the file.
So it looks to me as if in case a write operation releases
recordNumbersLock and starts writing to the file and at the same time the shutdown hook uses CleanExit to lock
recordNumbers the database file may still end up corrupt?
Can you please help me with what I am missing?
Regards,
Martin
PS: I searched the forum but did not find the answer, so if it is already there please have mercy (newbie bonus)