3

Docs for File.renameTo() say: "Many aspects of the behavior of this method are inherently platform-dependent: The rename (...) might not be atomic..."

That is pretty vague and I need disambiguation. Is this method atomic in Oracle Java 6 on WinXP and newer?

1
  • I suspect it depends on whether you are renaming a file in a directory, moving a file around a file system or moving a file between file systems (which is a copy and a delete) Commented Nov 18, 2011 at 15:03

2 Answers 2

4

Based on this answerxpost

"Win32 does not guarantee atomic file meta data operations. I'd provide a citation, but there is none - that fact that there's no written or documented guarantee means as much"

No.

Sign up to request clarification or add additional context in comments.

Comments

4

Since win32 historically didn't provide any support for atomic file moves/renames, that's highly unlikely.

They added functions for this with Vista, so the new file functions in Java7 may actually use those - no idea. But for XP you're out of luck.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.