code: @Override
      public void run() {
  
          try {
  
              // Set up
              Path path = FileSystems.getDefault().getPath(this.path);
              watcher = FileSystems.getDefault().newWatchService();
              Scanner.start(path, watcher);
  
              while (true) {
  
                  // Reload when notified
                  synchronized (this) {
                      this.wait();
                  }
  
                  // Keep reloading until all changes have notified:
                  while (reloadRequested) {
                      reloadRequested = false;
                      Reflections reflections = ClassFinder.newReflections();
                      ApiHandler.setupApi(reflections);
                      Main.mainHandler.setupFilters(reflections);
                      Main.mainHandler.runStartups(reflections);
                  }
  
              }
  
          } catch (IOException | InterruptedException e) {
              try {
                  shutdown();
                  throw new RuntimeException("Error in " + ClassReloader.class.getSimpleName() + ", exiting.", e);
              } catch (IOException e1) {
                  e.printStackTrace();
              }
          }
  
      }
docs: Infinite loop that sets up the {@link WatchService} and triggers reloads
  as necessary whenever the instance is notified.