@Test public void run() throws Exception { Tool exec = new DirectIoAbortTransaction(repo); indoubt("ex1"); assertThat(count(production1), is(0)); assertThat(count(production2), is(0)); assertThat(ToolRunner.run(conf, exec, new String[] {"__UNKNOWN__"}), is(1)); assertThat(count(production1), is(0)); assertThat(count(production2), is(0)); assertThat(ToolRunner.run(conf, exec, new String[] {"ex1"}), is(0)); assertThat(count(production1), is(0)); assertThat(count(production2), is(0)); assertThat(ToolRunner.run(conf, exec, new String[] {"ex1"}), is(1)); }
@Override public int run(String[] args) { if (args.length == 1) { String executionId = args[0]; DirectIoTransactionEditor editor = new DirectIoTransactionEditor(repository); editor.setConf(getConf()); try { boolean aborted = editor.abort(executionId); return aborted ? 0 : 1; } catch (Exception e) { LOG.error(MessageFormat.format( "Failed to abort transaction (executionId={0})", executionId), e); return 1; } } else { LOG.error(MessageFormat.format( "Invalid arguments: {0}", Arrays.toString(args))); System.err.println(MessageFormat.format( "Usage: hadoop {0} -conf <datasource-conf.xml> [execution-id]", getClass().getName())); return 1; } }
DirectIoAbortTransaction extends Configured implements Tool { @Override public int run(String[] args) { if (args.length == 1) { String executionId = args[0]; DirectIoTransactionEditor editor = new DirectIoTransactionEditor(repository); editor.setConf(getConf()); try { boolean aborted = editor.abort(executionId); return aborted ? 0 : 1; } catch (Exception e) { LOG.error(MessageFormat.format( "Failed to abort transaction (executionId={0})", executionId), e); return 1; } } else { LOG.error(MessageFormat.format( "Invalid arguments: {0}", Arrays.toString(args))); System.err.println(MessageFormat.format( "Usage: hadoop {0} -conf <datasource-conf.xml> [execution-id]", getClass().getName())); return 1; } } }
DirectIoAbortTransaction extends Configured implements Tool { @Override public int run(String[] args) { if (args.length == 1) { String executionId = args[0]; DirectIoTransactionEditor editor = new DirectIoTransactionEditor(repository); editor.setConf(getConf()); try { boolean aborted = editor.abort(executionId); return aborted ? 0 : 1; } catch (Exception e) { LOG.error(MessageFormat.format( "Failed to abort transaction (executionId={0})", executionId), e); return 1; } } else { LOG.error(MessageFormat.format( "Invalid arguments: {0}", Arrays.toString(args))); System.err.println(MessageFormat.format( "Usage: hadoop {0} -conf <datasource-conf.xml> [execution-id]", getClass().getName())); return 1; } } DirectIoAbortTransaction();   DirectIoAbortTransaction(DirectDataSourceRepository repository); }
DirectIoAbortTransaction extends Configured implements Tool { @Override public int run(String[] args) { if (args.length == 1) { String executionId = args[0]; DirectIoTransactionEditor editor = new DirectIoTransactionEditor(repository); editor.setConf(getConf()); try { boolean aborted = editor.abort(executionId); return aborted ? 0 : 1; } catch (Exception e) { LOG.error(MessageFormat.format( "Failed to abort transaction (executionId={0})", executionId), e); return 1; } } else { LOG.error(MessageFormat.format( "Invalid arguments: {0}", Arrays.toString(args))); System.err.println(MessageFormat.format( "Usage: hadoop {0} -conf <datasource-conf.xml> [execution-id]", getClass().getName())); return 1; } } DirectIoAbortTransaction();   DirectIoAbortTransaction(DirectDataSourceRepository repository); @Override int run(String[] args); static void main(String[] args); }
DirectIoAbortTransaction extends Configured implements Tool { @Override public int run(String[] args) { if (args.length == 1) { String executionId = args[0]; DirectIoTransactionEditor editor = new DirectIoTransactionEditor(repository); editor.setConf(getConf()); try { boolean aborted = editor.abort(executionId); return aborted ? 0 : 1; } catch (Exception e) { LOG.error(MessageFormat.format( "Failed to abort transaction (executionId={0})", executionId), e); return 1; } } else { LOG.error(MessageFormat.format( "Invalid arguments: {0}", Arrays.toString(args))); System.err.println(MessageFormat.format( "Usage: hadoop {0} -conf <datasource-conf.xml> [execution-id]", getClass().getName())); return 1; } } DirectIoAbortTransaction();   DirectIoAbortTransaction(DirectDataSourceRepository repository); @Override int run(String[] args); static void main(String[] args);  }