So, I'm writing my choices about the Lock and I have a doubt...
My solution use the Channel to Lock the database file to restrict at one access for time... I specifys...
When application run as Server & Client (run the server and run some client), the Server lock the database, and, if I start the application in Standalone mode too, I throws an Exception with "File alredy open..." (my choice)
The Server can receive any number of Client's connection... The Standalone can execute only one for time...
Its a BAD???
My assignment clearly says (and i guess yours too):
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.
So using a Channel to restrict access to database file is not necessary and you are doing more than you should do. You will nog get any extra points for doing so, only get points deducted if you made a mistake or if you have very complicated code for doing that.
And it's totally ok for your standalone application to be executed only one time, because there is at most 1 program accessing the db-file. So it's your standalone application or your server application or another application that's using that database-file.
All I have said in my choices.txt in my assumptions is something on the line:
* The stand-alone version and networked version will not run at the same time on the same computer
The only lock issue you do need to worry is the record locking (eg those lock, unlock, isLocked methods). What you are doing with Channel is more of file locking which can be assumed.
It's clearly in the assignment, so i guess you don't have to mention anything about it in choices.txt
K. Tsang wrote:The stand-alone version and networked version will not run at the same time on the same computer
And if i am really picky: if they both use a db-file that's on the same network as the both computers, you still would have a problem