I have a cluster of machines, each running a Java app.
These Java apps need to access a unique resource.txt file concurently.
resource.txt
I need to atomical
For Java 1.7+, use java.nio.file.Files.move(Path source, Path target, CopyOption... options) with CopyOptions "REPLACE_EXISTING" and "ATOMIC_MOVE".
java.nio.file.Files.move(Path source, Path target, CopyOption... options)
See API documentation for more information.
For example:
Files.move(src, dst, StandardCopyOption.ATOMIC_MOVE);