Created
July 22, 2013 17:30
-
-
Save okram/6055822 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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