I was reading the instructions of my assignment, and it does not restrict me from using java.nio. This makes life a whole lot easier ( I am glad I do not need to re-invent the wheel ).
1. I can use a file channel for every record. 2. The locking/unlocking feature is already built in with FileLock. 3. I don't see any need to cache, because I can directly map a ByteBuffer to a single record in the database file.
Can someone give me a reason not to go down this path.
Referring to your second point: how do you get around this (from the FileLock API)?
File locks are held on behalf of the entire Java virtual machine. They are not suitable for controlling access to a file by multiple threads within the same virtual machine.