protected final <T, E extends Exception> T runTaskThrowOnConflict(TransactionTask<T, E> task, Transaction txn) throws E, TransactionFailedException { checkOpen(); try { T ret = task.execute(txn); if (txn.isUncommitted()) { txn.commit(); } return ret; } finally { // Make sure that anyone trying to retain a reference to this transaction // will not be able to use it. if (txn.isUncommitted()) { txn.abort(); } } }
protected final <T, E extends Exception> T runTaskThrowOnConflict(TransactionTask<T, E> task, Transaction txn) throws E, TransactionFailedException { checkOpen(); try { T ret = task.execute(txn); if (txn.isUncommitted()) { txn.commit(); } return ret; } finally { // Make sure that anyone trying to retain a reference to this transaction // will not be able to use it. if (txn.isUncommitted()) { txn.abort(); } } }