public void ensureStarted() { if (watcher != null) { return; } if (!folder.toFile().exists()) { return; } if (isMac()) { watcher = new OsxWatchService(folder); } else { watcher = new JdkWatchService(folder); } watcher.onChange(listener); }
public void stop() { if (watcher != null) { watcher.stop(); } }