Example #1
0
 private void maybeInitializeWatchService() throws IOException {
   if (watchFileChanges) {
     stopWatchService();
     try {
       watchService = FileSystems.getDefault().newWatchService();
     } catch (IOException e) {
       watchFileChanges = false;
     }
   }
 }
Example #2
0
 public void shutdown() throws IOException {
   // watchService field is not cleared so any attempt to use this class after shutdown will fail.
   stopWatchService();
 }