code: public InodePathPair lockInodePathPair(AlluxioURI path1, LockPattern lockPattern1,
        AlluxioURI path2, LockPattern lockPattern2) throws InvalidPathException {
      LockedInodePath lockedPath1 = null;
      LockedInodePath lockedPath2 = null;
      boolean valid = false;
      try {
        // Lock paths in a deterministic order.
        if (path1.getPath().compareTo(path2.getPath()) > 0) {
          lockedPath2 = lockInodePath(path2, lockPattern2);
          lockedPath1 = lockInodePath(path1, lockPattern1);
        } else {
          lockedPath1 = lockInodePath(path1, lockPattern1);
          lockedPath2 = lockInodePath(path2, lockPattern2);
        }
        valid = true;
        return new InodePathPair(lockedPath1, lockedPath2);
      } finally {
        if (!valid) {
          if (lockedPath1 != null) {
            lockedPath1.close();
          }
          if (lockedPath2 != null) {
            lockedPath2.close();
          }
        }
      }
    }
docs: Locks existing inodes on the two specified paths. The two paths will be locked in the correct
  order. The target inodes are not required to exist.
  
  @param path1 the first path to lock
  @param lockPattern1 the locking pattern for the first path
  @param path2 the second path to lock
  @param lockPattern2 the locking pattern for the second path
  @return a {@link InodePathPair} representing the two locked paths
  @throws InvalidPathException if a path is invalid