src/main/java/unimelb/mf/client/sync/task/FileWatchTaskProducer.java
private void register(Path dir) throws IOException {
        WatchKey key = dir.register(_watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
        Path prev = _watchKeys.get(key);
        if (prev == null) {
            _logger.info(String.format("Started watching directory: %s", dir));
        } else {
            if (!dir.equals(prev)) {
                _logger.info(String.format("Updated watching directory: %s -> %s", prev, dir));
            }
        }
        _watchKeys.put(key, dir);
    }
/**
     * Register the given directory with the WatchService
     */
Register the given directory with the WatchService
Register the given directory with the WatchService
private void register(Path dir) throws IOException {
        WatchKey key = dir.register(_watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
        Path prev = _watchKeys.get(key);
        if (prev == null) {
            _logger.info(String.format("Started watching directory: %s", dir));
        } else {
            if (!dir.equals(prev)) {
                _logger.info(String.format("Updated watching directory: %s -> %s", prev, dir));
            }
        }
        _watchKeys.put(key, dir);
    }
private void register ( Path dir ) throws IOException { WatchKey key = dir . register ( _watcher , ENTRY_CREATE , ENTRY_DELETE , ENTRY_MODIFY ) ; Path prev = _watchKeys . get ( key ) ; if ( prev == null ) { _logger . info ( String . format ( "Started watching directory: %s" , dir ) ) ; } else { if ( ! dir . equals ( prev ) ) { _logger . info ( String . format ( "Updated watching directory: %s -> %s" , prev , dir ) ) ; } } _watchKeys . put ( key , dir ) ; }
Register the given directory with the WatchService
Register the given directory with the WatchService