• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: Locking the properties file ?

 
Tony Collins
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Reading the instructions below:-

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. Any attempt to lock a resource that is already locked should cause the current thread to give up the CPU, consuming no CPU cycles until the desired resource becomes available.

But do we need to lock the properties file, or can we assume that our server and clients run in different directories ? I assume that if we constrict our program to only run one instance in a particular directory we avoid the need for locking.
And if we do allow multiple clients to run in the same directory their going to end up running with the same config info.
I think it's clear that only one server can run at a time.
I assume the IOException is thrown when two programs try to access the same properties file at the same time, but does this corrupt the file ? And how can you lock a file between seperate programs.
Tony
[ September 12, 2003: Message edited by: Tony Collins ]
[ September 12, 2003: Message edited by: Tony Collins ]
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tony,

No.
Best,
Vlad
 
Tony Collins
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you say no Vlad ?
Tony
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic