code: public static FileLocker getLock(File lockFile) {
          lockFile.getParentFile().mkdirs();
          if (!lockFile.exists()) {
              try {
                  IOHelper.write(lockFile, "I have the lock!");
                  lockFile.deleteOnExit();
                  return new FileLocker(lockFile);
              } catch (IOException e) {
                  // Ignore
              }
          }
          return null;
  
      }
docs: Attempts to grab the lock for the given file, returning a FileLock if
  the lock has been created; otherwise it returns null