public void register ( Path dir ) throws IOException { if ( ! enable ) return ; WatchKey key = dir . register ( watcher , ENTRY_CREATE , ENTRY_DELETE , ENTRY_MODIFY ) ; if ( trace ) { Path prev = keys . get ( key ) ; if ( prev == null ) { System . out . format ( "CatalogWatcher register: %s%n" , dir ) ; } else { if ( ! dir . equals ( prev ) ) { System . out . format ( "update: %s -> %s%n" , prev , dir ) ; } } } keys . put ( key , dir ) ; }
Register the given directory with the WatchService