Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 1
    depends on what they mean by "atomic". there's atomic-within-your-own-app, and atomic-for-all-apps-on-the-system. I'd suspect it's atomic for your app only, and can't do anything to protect some other parallel process jumping in and sniping the file away from you. Commented Nov 10, 2014 at 18:49
  • 2
    You could bail on using a file, and just open a port. Commented Nov 10, 2014 at 18:58
  • 1
    @MarcB: I expected the Javadoc to mean systemwide atomicity: "… are a single operation that is atomic with respect to all other filesystem activities…". But good point, did not think about that… Commented Nov 11, 2014 at 19:12
  • @MarkW: Good idea. But I think I'll stick to my file based solution, unless someone comes up with a reason not to. The application does not need to be bullet proof after all… ;-) Commented Nov 11, 2014 at 19:12
  • 1
    I looked at the jgit source code and they are using the same approach (LockFile). As pointed out in another answer, I guess this is kind of valid for a local fs. Commented Jul 18, 2017 at 23:07