private void rollback(Transaction tx) { try { tx.failure(); tx.close(); } finally { tx = null; closeSession(); } }
@Override public void failure() { if ( tx != null ) { try { tx.failure(); tx.close(); } finally { tx = null; closeSession(); } } }
@Override public void rollback() { try { if (transactionManager.canRollback()) { LOGGER.debug("Rolling back native transaction: {}", nativeTransaction); if (nativeTransaction.isOpen()) { nativeTransaction.failure(); nativeTransaction.close(); } else { LOGGER.warn("Transaction is already closed"); } closeNativeSessionIfPossible(); } } catch (Exception e) { closeNativeSessionIfPossible(); throw new TransactionException(e.getLocalizedMessage(), e); } finally { super.rollback(); } }
@Override public void rollback() { try { if (transactionManager.canRollback()) { LOGGER.debug("Rolling back native transaction: {}", nativeTransaction); if (nativeTransaction.isOpen()) { nativeTransaction.failure(); nativeTransaction.close(); } else { LOGGER.warn("Transaction is already closed"); } closeNativeSessionIfPossible(); } } catch (Exception e) { closeNativeSessionIfPossible(); throw new TransactionException(e.getLocalizedMessage(), e); } finally { super.rollback(); } }
if (btx != null) btx.failure(); tx.failure(); } finally { if (btx == null && tx != null) {
private <T> T transaction( AccessMode mode, TransactionWork<T> work, TransactionConfig config ) { // use different code path compared to async so that work is executed in the caller thread // caller thread will also be the one who sleeps between retries; // it is unsafe to execute retries in the event loop threads because this can cause a deadlock // event loop thread will bock and wait for itself to read some data return retryLogic.retry( () -> { try ( Transaction tx = beginTransaction( mode, config ) ) { try { T result = work.execute( tx ); tx.success(); return result; } catch ( Throwable t ) { // mark transaction for failure if the given unit of work threw exception // this will override any success marks that were made by the unit of work tx.failure(); throw t; } } } ); }
if (btx != null) btx.failure(); tx.failure(); } finally { if (btx == null && tx != null) {
Transaction tx = getTransaction(); if (failed) tx.failure(); else tx.success();
Transaction tx = getTransaction(); if (failed) tx.failure(); else tx.success();
tx.failure(); tx.close();