code: public static boolean inotify(File file, FileNotify notify, int timeout) throws IllegalArgumentException
    {
      Params.notNull(file, "File");
  
      Predicate predicate = INOTIFY_PREDICATES.get(notify);
      if(predicate == null) {
        throw new BugError("Unsupported file notification |%s|. Missing predicate.", notify);
      }
  
      long timestamp = System.currentTimeMillis() + timeout;
      while(!predicate.test(file)) {
        if(timestamp <= System.currentTimeMillis()) {
          return false;
        }
        try {
          Thread.sleep(500);
        }
        catch(InterruptedException unused) {
          Thread.currentThread().interrupt();
        }
      }
      return true;
    }
docs: Wait for requested action to happen on given file. If <code>timeout</code> is zero or negative this method returns
  false immediately.
  <p>
  This implementation is a fallback solution for JVM without <code>java.nio.file.WatchService</code>. Please consider
  using watch service when available.
  
  @param file file to wait for its state change,
  @param notify notify type,
  @param timeout timeout value.
  @return true if file state change occurred before timeout or false otherwise.
  @throws IllegalArgumentException if <code>file</code> is null.