lock « nio « Java I/O Q&A





1. When using Java's FileLock, is it ok to let close() to automatically do a lock.release()?    stackoverflow.com

As most should know close() also closes any streams uses. This allows the follow code:

BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(...)));
...
br.close();
This is nice, since we don't need a reference to FileInputStream and ...

2. File locking and deleteing strategy using nio    coderanch.com

I've got a bunch of client apps all polling a single remote directory for new files, when one of the clients sees a new file it locks the file using a FileLock and copies it to another directory. Once that's done I need the client to delete the original file. The problem is that unless I release the FileLock I can't ...

3. NIO, locking and Win-XP    coderanch.com

This is reposted from Java in General, Intermediate. I had no response there, but this looks like a better place to post it. 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 ...