private void asyncCopyLocalPath(CopyThreadPoolExecutor pool, AlluxioURI srcPath,
      AlluxioURI dstPath) throws InterruptedException {
    File src = new File(srcPath.getPath());
    if (!src.isDirectory()) {
      pool.submit(() -> {
        try {
          copyFromLocalFile(srcPath, dstPath);
          pool.succeed(srcPath, dstPath);
        } catch (Exception e) {
          pool.fail(srcPath, dstPath, e);
        }
        return null;
      });
    } else {
      try {
        mFileSystem.createDirectory(dstPath);
      } catch (Exception e) {
        pool.fail(srcPath, dstPath, e);
        return;
      }
      File[] fileList = src.listFiles();
      if (fileList == null) {
        pool.fail(srcPath, dstPath,
            new IOException(String.format("Failed to list directory %s.", src)));
        return;
      }
      for (File srcFile : fileList) {
        AlluxioURI newURI = new AlluxioURI(dstPath, new AlluxioURI(srcFile.getName()));
        asyncCopyLocalPath(pool,
              new AlluxioURI(srcPath.getScheme(), srcPath.getAuthority(), srcFile.getPath()),
              newURI);
      }
    }
  }
private void asyncCopyLocalPath ( CopyThreadPoolExecutor pool , AlluxioURI srcPath , AlluxioURI dstPath ) throws InterruptedException { File src = new File ( srcPath . getPath ( ) ) ; if ( ! src . isDirectory ( ) ) { pool . submit ( ( ) -> { try { copyFromLocalFile ( srcPath , dstPath ) ; pool . succeed ( srcPath , dstPath ) ; } catch ( Exception e ) { pool . fail ( srcPath , dstPath , e ) ; } return null ; } ) ; } else { try { mFileSystem . createDirectory ( dstPath ) ; } catch ( Exception e ) { pool . fail ( srcPath , dstPath , e ) ; return ; } File [ ] fileList = src . listFiles ( ) ; if ( fileList == null ) { pool . fail ( srcPath , dstPath , new IOException ( String . format ( "Failed to list directory %s." , src ) ) ) ; return ; } for ( File srcFile : fileList ) { AlluxioURI newURI = new AlluxioURI ( dstPath , new AlluxioURI ( srcFile . getName ( ) ) ) ; asyncCopyLocalPath ( pool , new AlluxioURI ( srcPath . getScheme ( ) , srcPath . getAuthority ( ) , srcFile . getPath ( ) ) , newURI ) ; } } }
Asynchronously copies a file or directory specified by srcPath from the local filesystem to
dstPath in the Alluxio filesystem space, assuming dstPath does not exist.

@param srcPath the {@link AlluxioURI} of the source file in the local filesystem
@param dstPath the {@link AlluxioURI} of the destination
@throws InterruptedException when failed to send messages to the pool