/** Roll backs current transaction. */ private void rollbackCurrentTx() { try { TxContext ctx = txCtx.get(); if (ctx != null) { txCtx.remove(); GridCacheTx tx = cache.tx(); if (tx != null) tx.rollback(); } } catch (GridException e) { log.error("Failed to rollback cache transaction.", e); } }
/** * @param ctx Transaction context. * @param key Key. * @throws GridException If failed. */ private void unlock(TxContext ctx, Object key) throws GridException { if (ctx.unlocked(key)) { // Finish transaction if last key is unlocked. txCtx.remove(); GridCacheTx tx = cache.tx(); assert tx != null; try { tx.commit(); } finally { tx.close(); } assert cache.tx() == null; } }