so (as i understand) a client will access the server through the RMI but the
standalone mode would start an instance of the server and access through
it to the database. since they are 2 different server, there is a possibillity of
concurrent accessing the database. (clients and standalone)
am i right?
Allow me to participate in this conversation, what Roel De Nijs said:
According to the instructions there will be at most 1 application accessing the database file at any time, so that would be the standalone application or the network server, but never both at the same time
you can achieve this by using FileChannel.tryLock(), it helps in giving the JVM the exclusive lock over the file so now other process can lock it.
I hope you find it helpful.
instructions.html wrote: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.
The instructions clearly indicate that you don't need a lock over the file. So there is no need to add extra complexity to your program, because it will be unused. So your application has extra code, which have to be maintained, but will never be used.