3 ms·
It only falls back to polling if there is no support for using the native filesystem method. You don't have to use `poll()`, you can use `take()` which is the
by waffle_ss 15y ago
It only falls back to polling if there is no support for using the native filesystem method.
You don't have to use `poll()`, you can use `take()` which is the blocking equivalent to it. In fact, in most use cases I would imagine you would spawn a thread and use `take()`. I'm guessing they called it `poll()` as it is non-blocking, so if you don't get a result then you have to keep calling it. However, I don't think it reflects the implementation details.
Here's the JavaDoc for more info (guess I should have linked to it originally): http://docs.oracle.com/javase/7/docs/api/java/nio/file/WatchService.html http://docs.oracle.com/javase/7/docs/api/java/nio/file/Watch...