question: public static boolean createFileWatcher ( Path file , FileChangedListener listener ) { if ( listener == null || file == null ) { return false ; } try { FileWatcher watcher = new FileWatcher ( file , listener ) ; Thread thread = new Thread ( watcher ) ; thread . start ( ) ; LOGGER . info ( "Added file watcher for: " + file . toAbsolutePath ( ) ) ; return true ; } catch ( IOException ex ) { LOGGER . warning ( "Error adding file watcher for: " + file . toAbsolutePath ( ) + " [" + ex + "]" ) ; return false ; } }
target:  Create a watcher that informs the given listener that the given file was modified. The watcher is run in it's own thread. The watcher accumulates events so it takes a few seconds after a modification for the listener to be informed.