-
Notifications
You must be signed in to change notification settings - Fork 0
Initial pure JDK implementation #1
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
Conversation
This better reflects other recursive implementations
|
@sungshik thanks for the thorough review, I think I've address all comments. |
|
I'm still doubting the exact interface of the |
sungshik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the interface of the Watcher class is much clearer now; well done! My only suggestion is to rename the enum values a bit (but this is really a matter of taste, so just see how you feel about it). Longer term (not this PR), it could be nice to consider abstracting away also the usage of java.nio.file.Path in the public methods of Watcher and use, for instance, Rascal(-style) locations (if there's a use case for this, but I imagine there could be).
I also had a look at the other changes, and it all looks fine, except I think there are still races in BundledSubscription. I tried to come up with a fix, but it's tricky to do it without bigger synchronization blocks. Here's a proposal. The correctness guarantee I can give is: I'm not convinced it's wrong 😉. Also, with more effort, it might be possible to make the synchronized blocks a bit smaller (e.g., pull active.remove and active.add outside).
src/main/java/engineering/swat/watch/impl/BundledSubscription.java
Outdated
Show resolved
Hide resolved
src/main/java/engineering/swat/watch/impl/BundledSubscription.java
Outdated
Show resolved
Hide resolved
src/main/java/engineering/swat/watch/impl/BundledSubscription.java
Outdated
Show resolved
Hide resolved
src/main/java/engineering/swat/watch/impl/BundledSubscription.java
Outdated
Show resolved
Hide resolved
src/main/java/engineering/swat/watch/impl/BundledSubscription.java
Outdated
Show resolved
Hide resolved
Looks like it might be a bug in the JDK registry
sungshik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a look at the tests. Just a few small things 👍
| void run(Path target) throws IOException; | ||
| } | ||
|
|
||
| private static void recursiveDelete(Path target) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also a method deleteAllFiles in class TestDirectory
sungshik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And a review of the non-test code since last review. Looks good!
Co-authored-by: sungshik <[email protected]>
…s without breaking binary compatibility
2b3ee52 to
982ce65
Compare
On-and-off I've been working on a nice reference implementation of a file changes watcher. Both the raw api, and the tests I could come up with.
The future will bring windows & linux (and maybe osx) specific implementation that can benefit from the native kernel api.
todo: