Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up locking in FilePath* #2228

Open
grandinj opened this issue Nov 5, 2019 · 0 comments
Open

clean up locking in FilePath* #2228

grandinj opened this issue Nov 5, 2019 · 0 comments

Comments

@grandinj
Copy link
Contributor

grandinj commented Nov 5, 2019

After looking at #2205 and concluding the FilePathSplit had deficient locking, I decided to look at the other file path implementations.

And it looks like only FilePathDisk is really OK (because it just uses the underlying FileChannel).

Now FilePath is supposed to be a FileChannel replica, so it should obey the same multi-threading semantics, which are document here:
https://docs.oracle.com/javase/7/docs/api/java/nio/channels/FileChannel.html
to be

File channels are safe for use by multiple concurrent threads. The close method may be invoked at any time, as specified by the Channel interface. Only one operation that involves the channel's position or can change its file's size may be in progress at any given time; attempts to initiate a second such operation while the first is still in progress will block until the first operation completes. Other operations, in particular those that take an explicit position, may proceed concurrently; whether they in fact do so is dependent upon the underlying implementation and is therefore unspecified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant