Skip to content

Instantly share code, notes, and snippets.

@okram
Created July 22, 2013 17:30
Show Gist options
  • Save okram/6055822 to your computer and use it in GitHub Desktop.
Save okram/6055822 to your computer and use it in GitHub Desktop.
@Override
public void cleanup(final Mapper<NullWritable, FaunusVertex, LongWritable, Holder<FaunusVertex>>.Context context) throws IOException, InterruptedException {
if (this.graph instanceof TransactionalGraph) {
try {
((TransactionalGraph) this.graph).commit();
context.getCounter(Counters.SUCCESSFUL_TRANSACTIONS).increment(1l);
} catch (Exception e) {
LOGGER.error("Could not commit transaction during Map.cleanup():", e);
((TransactionalGraph) this.graph).rollback();
context.getCounter(Counters.FAILED_TRANSACTIONS).increment(1l);
}
}
this.graph.shutdown();
}
/////////////////////////
@Override
public void cleanup(final Mapper<NullWritable, FaunusVertex, LongWritable, Holder<FaunusVertex>>.Context context) throws IOException, InterruptedException {
if (this.graph instanceof TransactionalGraph) {
try {
((TransactionalGraph) this.graph).commit();
context.getCounter(Counters.SUCCESSFUL_TRANSACTIONS).increment(1l);
} catch (Exception e) {
LOGGER.error("Could not commit transaction during Map.cleanup():", e);
((TransactionalGraph) this.graph).rollback();
context.getCounter(Counters.FAILED_TRANSACTIONS).increment(1l);
throw new IOException(e.getMessage());
}
}
this.graph.shutdown();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment