code: private void lockSourceAndCopy(File sourceFile, File copyFile) {
      sourceFile.opened();
      ReadWriteLock sourceLock = sourceFile.contentLock();
      if (sourceLock != null) {
        sourceLock.readLock().lock();
      }
      ReadWriteLock copyLock = copyFile.contentLock();
      if (copyLock != null) {
        copyLock.writeLock().lock();
      }
    }
docs: Locks source and copy files before copying content. Also marks the source file as opened so
  that its content won't be deleted until after the copy if it is deleted.