@Override
  public int run(String[] args) throws Exception {
    Job job = createSubmittableJob(args);
    if (job == null) {
      return 1;
    }
    if (!job.waitForCompletion(true)) {
      LOG.info("Map-reduce job failed!");
      if (bulkload) {
        LOG.info("Files are not bulkloaded!");
      }
      return 1;
    }
    int code = 0;
    if (bulkload) {
      LOG.info("Trying to bulk load data to destination table: " + dstTableName);
      LOG.info("command: ./bin/hbase {} {} {}", BulkLoadHFilesTool.NAME,
        this.bulkloadDir.toString(), this.dstTableName);
      if (
        !BulkLoadHFiles.create(getConf()).bulkLoad(TableName.valueOf(dstTableName), bulkloadDir)
          .isEmpty()
      ) {
        // bulkloadDir is deleted only BulkLoadHFiles was successful so that one can rerun
        // BulkLoadHFiles.
        FileSystem fs = CommonFSUtils.getCurrentFileSystem(getConf());
        if (!fs.delete(this.bulkloadDir, true)) {
          LOG.error("Deleting folder " + bulkloadDir + " failed!");
          code = 1;
        }
      }
    }
    return code;
  }
Main entry point.
@param args The command line parameters.
@throws Exception When running the job fails.
hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/CopyTable.java