• Post Reply Bookmark Topic Watch Topic
  • New Topic

Locking the file access  RSS feed

 
SiriVennela Arepalli
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way to lock restrict one process to access the file read when other process is reading the file (two processess are running simultaneously) without the use of threads or synchronization or FileLock in JDK 1.4 version .
 
raimondas zemaitis
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you mean different processes - different JVMs then I think this is possible by introducing your custom file lock which would act like object lock, i.e. say first process creates some file (eg .lock) another process checks for presence of this file and vice versa. When access is finished lock file is removed.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!