@Override public void exitTransaction(@Nonnull Transaction tx) throws IOException { tx.exit(); } }
@Override protected void finished() throws IOException { mCursor.link().exit(); } }
@Override public boolean txnRollback(long txnId) throws IOException { Transaction txn = txn(txnId); if (txn != null) { txn.exit(); } return true; }
@Override public boolean txnRollback(long txnId) throws IOException { Transaction txn = txn(txnId); if (txn != null) { txn.exit(); } return true; }
@Override public boolean txnRollback(long txnId) throws IOException { Transaction txn = txn(txnId); if (txn != null) { txn.exit(); } return true; }
@Override public boolean txnRollback(long txnId) throws IOException { Transaction txn = txn(txnId); if (txn != null) { txn.exit(); } return true; }
@Override public boolean txnRollback(long txnId) throws IOException { Transaction txn = txn(txnId); if (txn != null) { txn.exit(); } return true; }
@Override public void exitTransaction(@Nonnull Transaction tx) throws IOException { final TransactionHolder holder = threadLocalTxHolder.get(); holder.checkTransactionAvailability(); --holder.usages; if (holder.usages == 0) { // this is the last transaction usage holder.tx.exit(); holder.tx = null; } }
@Override public boolean txnRollback(long txnId) throws IOException { Transaction txn = txn(txnId); if (txn != null) { txn.exit(); } return true; }
@Override public boolean txnCommit(long txnId) throws IOException { Transaction txn = txn(txnId); if (txn != null) { txn.commit(); txn.exit(); } return true; }
@Override public boolean txnCommit(long txnId) throws IOException { Transaction txn = txn(txnId); if (txn != null) { txn.commit(); txn.exit(); } return true; }
/** * Called at most once, when no more entries remain. */ protected void finished() throws IOException { Transaction txn = mCursor.link(); txn.commit(); txn.exit(); } }
@Override public boolean txnCommit(long txnId) throws IOException { Transaction txn = txn(txnId); if (txn != null) { txn.commit(); txn.exit(); } return true; }
@Override public boolean txnCommit(long txnId) throws IOException { Transaction txn = txn(txnId); if (txn != null) { txn.commit(); txn.exit(); } return true; }
public default void rollback() { try { this.getRawTx().exit(); } catch (IOException e) { throw new ChronoDBCommitException("Failed to rollback transaction! See root cause for details.", e); } }
@Override public boolean txnCommit(long txnId) throws IOException { Transaction txn = txn(txnId); if (txn != null) { txn.commit(); txn.exit(); } return true; }
@Override public boolean txnCommit(long txnId) throws IOException { Transaction txn = txn(txnId); if (txn != null) { txn.commit(); txn.exit(); } return true; }
@Override public void commit() throws BackendException { log.trace("commit txn={}, id={}", txn, id); try { txn.commit(); txn.exit(); if(DurabilityMode.NO_REDO == txn.durabilityMode()) { //TODO should I always call checkpoint? database.checkpoint(); } } catch (IOException e) { throw new PermanentBackendException("unable to commit tx " + id, e); } }
@Override public byte[] load(Transaction txn, byte[] key) throws IOException { if (mCombiner.combineLocks()) combine: { if (txn == null) { txn = newTransaction(null); txn.lockMode(LockMode.REPEATABLE_READ); } else if (txn.lockMode() == LockMode.READ_COMMITTED) { txn.enter(); } else { break combine; } try { return doLoad(txn, key); } finally { txn.exit(); } } return doLoad(txn, key); }
@Override public byte[] load(final Transaction txn, final byte[] tkey) throws IOException { final byte[] key = inverseTransformKey(tkey); if (key == null) { return null; } if (txn == null || !txn.lockMode().isRepeatable()) { return mTransformer.transformValue(mSource.load(txn, key), key, tkey); } txn.enter(); try { byte[] value = mSource.load(txn, key); if (value == null || (value = mTransformer.transformValue(value, key, tkey)) != null) { // Keep the lock if value doesn't exist or if allowed by transformer. txn.commit(); } return value; } finally { txn.exit(); } }