• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

FileLock in XP environment

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've searched for how Win-XP handles shared locks and exclusive locks under nio, but have been unable to find anything yet. I have one program that reads a file, and does a shared lock of part of the file, then waits. A second program attempts to access a different portion of the file (no overlap) for writing. I get the run-time IOException:
"The process cannot access the file because another process has locked a portion of the file". This happens whether I use shared lock or exclusive lock.

Does someone know what XP allows in this situation, or whether I may be doing something that won't work regardless of the OS environment?

Thanks.

Code snippet from first program:



Code snippet from second program:


(the IOException occurs on the FileLock statement)
 
On top of spaghetti all covered in cheese, there was this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic