예제 #1
0
  /**
   * Executes ETL based on a specified configuration.
   *
   * @param indicator progress indicator to use.
   * @return execution statistics for ETL execution.
   * @throws EtlExecutorException if ETL fails.
   */
  @ThreadSafe
  public ExecutionStatistics execute(final ProgressIndicator indicator)
      throws EtlExecutorException {
    EtlContext ctx = null;
    JmxEtlManager etlManager = null;

    try {
      ctx = prepare(indicator);
      if (jmxEnabled) {
        etlManager = new JmxEtlManager(ctx);
        etlManager.register();
      }
      execute(ctx);
      ctx.getProgressCallback().step(5, "Commiting transactions");
      commitAll(ctx);
    } catch (Throwable e) {
      if (ctx != null) {
        rollbackAll(ctx);
      }
      throw new EtlExecutorException(e);
    } finally {
      if (ctx != null) {
        closeAll(ctx);
        ctx.getStatisticsBuilder().etlComplete();
        ctx.getProgressCallback().complete();
      }
      if (etlManager != null) {
        etlManager.unregister();
      }
    }

    return ctx.getStatisticsBuilder().getStatistics();
  }
 public void rollbackAll(final EtlContext ctx) {
   super.rollbackAll(ctx);
 }