code: public static boolean waitForFile(File file) {
          if (file.isFile()) {
              return true;
          } else {
              // Start waiting 10 seconds maximum
              long timeout = System.currentTimeMillis() + FILE_WAIT_TIMEOUT;
              while (System.currentTimeMillis() <= timeout) {
                  sleepQuietly(10);
                  if (file.isFile()) {
                      return true;
                  }
              }
          }
          // Timeout reached
          return false;
      }
docs: Waits for a file to be created.
  
  @param file the file
  @return {@literal true} if the file was created, {@literal false} otherwise