We have an NFS share which receives files. We also have multiple processes listening for new files in this share.
What would be a safe way (in Java) of accessing this file and ensure that only one process can process this file?
We were planning to (as first step) let the process move the file - but that might not be atomic on NFS? What about renaming the file first and then move it? Or will multiple processes be able to rename the same file on NFS? I guess a safe way would be to add a file locked flag in a database with row locking but that seems to be overkill.
Any advice?