Esempio n. 1
0
  private static void writeHadoopConfig(File hadoopConfPath) {
    Configuration conf = HadoopFileSystem.getHadoopConfiguration();

    if (hadoopConfPath.exists()) {
      if (!hadoopConfPath.delete()) {
        throw new RuntimeException(
            "Error deleting existing Hadoop configuration: " + hadoopConfPath);
      }
    }
    try (DataOutputStream out = new DataOutputStream(new FileOutputStream(hadoopConfPath))) {
      conf.write(out);
    } catch (IOException e) {
      LOG.error("Error writing Hadoop Configuration.", e);
    }
  }