code: public final FileLock lock(final int tryLockMax, final long tryWaitMillis) throws LockingFailedException {
  
          return Utils4J.lockRandomAccessFile(file, tryLockMax, tryWaitMillis);
  
      }
docs: Lock the file.
  
  @param tryLockMax
  Number of tries to lock before throwing an exception.
  @param tryWaitMillis
  Milliseconds to sleep between retries.
  
  @return FileLock.
  
  @throws LockingFailedException
  Locking the file failed.