Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File-level locking?

 
Richard Hull
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just wondering what the general consensus is regarding file-level locking in the assignment.
Without it, it is entirely possible to have a server running, with 2+ clients working happily with record-locking maintaining consistency in the servers JVM, but what happens, say, if I start up another client (in local-mode this time), and the file I pick happens to be the database file that the server is currently using.
If the record-locking is maintained in the servers JVM, then the additional local client won't know anything about the servers locks, and might well update the database, causing corruption in the file.
 
Charles Miller
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a valid point and, as you have probably figured out, the instructions don't cover that. For my submission, I made note of that in the user documentation... that if a connection to a particular database is in local mode, that no other connections should be made to that database (local or remote). Hopefully my solution is sufficient.
 
Eduard Jodas
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not completely sure but I think you can't open a random access file twice for update.
Anyway, jdk1.4 allows you to lock a file.
 
Chiji Nwankwo
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was under the impression that we needed 2 copies of the db.db file. One that resides on the client side and the other residing one the server side. This way there would be no conflict.
Please correct me if I am wrong in thinking that.
Chiji
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Local mode and server mode will be using different db.db files. Or should I jsut say that the assessor will not run both at the same time. Don't worry about this situation.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic