Hi everyone, I've been reading the forum for a while and just started my SCJD assignment. I'm working on URLyBird 1.2.1.
First question from me, the specification states:
You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server.
Does that mean shared read lock is not allowed? i.e. there will be no concurrent read? I was going to use ReadWriteLock class for locking, but it seems synchronized block is sufficient since shared read lock is not required?
If you are planning to use RandomAccessFile for reading/writing data, then reading/writing operations should be in synchronized context. Imagine a scenario when two threads are trying to read from different locations of the data file - one gets pointer to read from one location and then the other moves the pointer away to read from another location.