Skip to content

File Writes Are Not Thread Safe #51

Description

@RickeyWard

Using this in a simple Servlet container application and ran into concurrency issues where multiple threads are trying to write to the file at the same time. Looked at the code the only write protection is a FileLock, and the java documentation states that

File locks are held on behalf of the entire Java virtual machine. They are not suitable for controlling access to a file by multiple threads within the same virtual machine. (reference)

It should be as simple as marking the io methods synchronized.

I'm happy to do a RP if its welcomed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions