Use Files.move atomicity carefully
Files.move with ATOMIC_MOVE is provider-dependent and may fail across file systems. Handle AtomicMoveNotSupportedException and define whether a non-atomic fallback is safe for the operation.
Files.move with ATOMIC_MOVE depends on the file system provider and can fail across volumes. Catch AtomicMoveNotSupportedException and decide whether a non-atomic fallback is safe for that operation.
Atomic renames are not guaranteed everywhere, and crossing file systems is a common case where they fail. Handle the exception and document whether a copy-then-delete fallback preserves your guarantees.
Clear note on java / files. "Use Files.move atomicity carefully" is the kind of detail that is easy to overlook.
An atomic move may be unavailable depending on provider and destination, so the same code can behave differently in production. Treat the fallback as a separate design choice with its own failure modes.
"Use Files.move atomicity carefully" is a useful thing to know about with java / files. Thanks for sharing it.
Good to see "Use Files.move atomicity carefully" written down. Handy reference for anyone working with java / files.
Appreciate the write-up on "Use Files.move atomicity carefully". Useful for anyone using java / files.
"Use Files.move atomicity carefully" is a useful thing to know about with java / files. Thanks for sharing it.