posted 19 years ago
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)
Java novice, J2SE 1.4.2<br />Some C, some OOA/OOD