Skip to content

Commit 85f57ad

Browse files
committed
Created related work section
1 parent e1a77b6 commit 85f57ad

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,26 @@
11
# java-watch
2-
a java file watcher that works across platforms and supports recursion
2+
a java file watcher that works across platforms and supports recursion and single file watches
3+
4+
5+
## Related work
6+
After reading the documentation of the following discussion on file system watches:
7+
8+
- [Paul Millr's nodejs chokidar](https://github.com/paulmillr/chokidar)
9+
- [Enrico Maria Crisostomo's c++ fswatch/libfswatch](https://github.com/emcrisostomo/fswatch)
10+
- [work by rjeczalik in the go notify package](https://pkg.go.dev/github.com/rjeczalik/notify)
11+
- [Greg Methvin's java library directory-watcher](https://github.com/gmethvin/directory-watcher)
12+
- [Pathikrit Bhowmick's scala library better-files](https://github.com/pathikrit/better-files)
13+
- [Java's documentation on a recursive file watcher](https://docs.oracle.com/javase/tutorial/displayCode.html?code=https://docs.oracle.com/javase/tutorial/essential/io/examples/WatchDir.java)
14+
- [openjdk's PR 10140/8293067 to try and use FSEventStream on macOS](https://github.com/openjdk/jdk/pull/10140)
15+
- [nodejs watch function caveats](https://nodejs.org/docs/latest/api/fs.html#caveats)
16+
- [Overview in 2012 by regedit](https://lists.qt-project.org/pipermail/development/2012-July/005279.html)
17+
18+
We can come to the following conclusion: file system watches are hard and have platform specific limitations.
19+
In summary:
20+
21+
| OS | API | file | directory | recursive directory | overflow | network | notes|
22+
| -- | -- | -- | --- | -- |---|--| -- |
23+
| Windows | [`ReadDirectoryChangesW`](https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-readdirectorychangesw) |||| generic error marker | some, error in case not supported | hard to correctly setup (there are multiple ways to get updates), can be chatty with it's events. can lock the directory it's monitoring. |
24+
| Linux | [inotify](https://man7.org/linux/man-pages/man7/inotify.7.html) |||| generic error marker | only local changes, no error | note that the new [fanotify](https://man7.org/linux/man-pages/man7/fanotify.7.html) supports recursive watches, but only at mount points, not for arbitrary directories. |
25+
| macOS & BSD | [kqueue](https://man.freebsd.org/cgi/man.cgi?kqueue) | ? ||| can quickly run out of file descriptors | ? | implementing recursive directory watches this way will quickly run out of file descriptors |
26+
| macOS | [FSEvents](https://developer.apple.com/documentation/coreservices/file_system_events) |||| generic error marker | ? | Some report it works great, but openjdk stopped doing this direction of the implementation as it consistently failed a test with a lot of IO operations and register and unregisters of watches. Reporting that the API would just stop reporting any events |

0 commit comments

Comments
 (0)