public static void main()

in ambari-metrics-timelineservice/src/main/java/org/apache/ambari/metrics/core/timeline/upgrade/core/MetricsDataMigrationLauncher.java [315:369]


  public static void main(String[] args) {
    String processedMetricsFilePath = null;
    String whitelistedFilePath = null;
    Long startDay = null;
    Integer numberOfThreads = null;
    Integer batchSize = null;
    Long timeoutInMinutes = DEFAULT_TIMEOUT_MINUTES;

    if (args.length>0) {
      processedMetricsFilePath = args[0];
    }
    if (args.length>1) {
      whitelistedFilePath = args[1];
    }
    if (args.length>2) {
      startDay = Long.valueOf(args[2]);
    }
    if (args.length>3) {
      numberOfThreads = Integer.valueOf(args[3]);
    }
    if (args.length>4) {
      batchSize = Integer.valueOf(args[4]);
    }
    if (args.length>5) {
      timeoutInMinutes = Long.valueOf(args[5]);
    }

    MetricsDataMigrationLauncher dataMigrationLauncher = null;
    try {
      LOG.info("Initializing system...");
      dataMigrationLauncher = new MetricsDataMigrationLauncher(whitelistedFilePath, processedMetricsFilePath, startDay, numberOfThreads, batchSize);
    } catch (Exception e) {
      LOG.error("Exception during system setup, exiting...", e);
      System.exit(1);
    }

    int exitCode = 0;
    try {
      dataMigrationLauncher.runMigration(timeoutInMinutes);
    } catch (Throwable e) {
      exitCode = 1;
      LOG.error("Exception during data migration, exiting...", e);
    } finally {
      try {
        dataMigrationLauncher.saveMetadata();
      } catch (SQLException e) {
        exitCode = 1;
        LOG.error("Exception while saving the Metadata, exiting...", e);
      }
    }

    if(exitCode == 0) LOG.info("Data migration finished successfully.");

    System.exit(exitCode);
  }