cryogen-project / cryogen-core

Cryogen's core
Eclipse Public License 1.0
69 stars 62 forks source link

Use juxt.dirwatch in cryogen-core.watcher #46

Closed jstepien closed 9 years ago

jstepien commented 9 years ago

This patch replaces the 300ms loop with a file watcher. juxt.dirwatch is a wrapper around java.nio.file.WatchService, which provides file watching functionality implemented natively for platforms JVM is built for.

juxt.dirwatch brings no extra dependencies.

Now rebuilds should be instantaneous.

yogthos commented 9 years ago

Have you tested on OS X, last time I looked the JVM used a poll with a long timeout making the watch very unresponsive.

jstepien commented 9 years ago

I've just tested it on OS X and yes, it takes unbearably long time to react to changes! In such case I'll close this PR. Instead, I'll leave here a couple of links explaining why this approach won't work until WatchService is properly implemented on Mac.

yogthos commented 9 years ago

By the way, I did a post on this here and it is possible to force Java to poll more aggressively on OS X. So, that would be a way to implement this using file watchers.