Skip to content

Instantly share code, notes, and snippets.

@spullara
Created October 7, 2014 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spullara/5c34cd63cf2c2879763a to your computer and use it in GitHub Desktop.
Save spullara/5c34cd63cf2c2879763a to your computer and use it in GitHub Desktop.
@Override
public <T> T run(final Function<? super Transaction, T> tFunction) {
return database.run(new Function<Transaction, T>() {
int tries = 0;
@Override
public T apply(Transaction tx) {
if (tries++ > 0) {
log.info("Retrying transaction: " + tries);
}
setOptions(tx);
return tFunction.apply(tx);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment