code: public int finalizeUpgrade() throws IOException {
      int exitCode = -1;
  
      DistributedFileSystem dfs = getDFS();
      if (dfs == null) {
        System.out.println("FileSystem is " + getFS().getUri());
        return exitCode;
      }
  
      dfs.finalizeUpgrade();
      exitCode = 0;
     
      return exitCode;
    }
docs: Command to ask the namenode to finalize previously performed upgrade.
  Usage: java DFSAdmin -finalizeUpgrade
  @exception IOException