@Override public void commitTransaction(@Nonnull Transaction tx) throws IOException { tx.commit(); }
@Override public void commitTransaction(@Nonnull Transaction tx) throws IOException { final TransactionHolder holder = threadLocalTxHolder.get(); holder.checkTransactionAvailability(); if (holder.usages == 1) { holder.tx.commit(); // commit only if this is the last usage } }
@Override protected void postUpdate() throws IOException { mCursor.link().commit(); }
@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; }
@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 boolean txnCommit(long txnId) throws IOException { Transaction txn = txn(txnId); if (txn != null) { txn.commit(); txn.exit(); } return true; }
public default void commit() { try { this.getRawTx().commit(); } catch (IOException e) { throw new ChronoDBCommitException("Failed to commit! See root cause for details.", e); } }
@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); } }
static void commit(Cursor c, byte[] value) throws IOException { try { c.store(value); } catch (Throwable e) { Transaction txn = c.link(); if (txn != null) { txn.reset(e); } throw e; } Transaction txn = c.link(); if (txn != null && txn != Transaction.BOGUS) { txn.commit(); } }
static void commit(Cursor c, byte[] value) throws IOException { try { c.store(value); } catch (Throwable e) { Transaction txn = c.link(); if (txn != null) { txn.reset(e); } throw e; } Transaction txn = c.link(); if (txn != null && txn != Transaction.BOGUS) { txn.commit(); } }
static void commit(Cursor c, byte[] value) throws IOException { try { c.store(value); } catch (Throwable e) { Transaction txn = c.link(); if (txn != null) { txn.reset(e); } throw e; } Transaction txn = c.link(); if (txn != null && txn != Transaction.BOGUS) { txn.commit(); } }
public void flush() { Database database = TuplUtils.openDatabase(this.metaFile, CACHE_SIZE_BYTES); try { Index index = database.openIndex(INDEX_NAME); Transaction tx = database.newTransaction(); try { for (Entry<String, String> entry : this.metaProperties.entrySet()) { byte[] key = TuplUtils.encodeString(entry.getKey()); byte[] val = TuplUtils.encodeString(entry.getValue()); index.store(tx, key, val); } tx.commit(); } finally { tx.reset(); } } catch (IOException e) { throw new ChronosIOException("Failed to open index '" + INDEX_NAME + "'! See root cause for details.", e); } finally { TuplUtils.shutdownQuietly(database); } }
@Override public boolean txnCommit(long txnId) throws IOException { TxnEntry te = getTxnEntry(txnId); // Allow side-effect free operations to be performed before acquiring latch. mOpLatch.acquireShared(); Latch latch = te.latch(); try { // Commit is expected to complete quickly, so don't let another // task thread run. Transaction txn = te.mTxn; try { txn.commit(); } finally { txn.exit(); } } finally { latch.releaseExclusive(); } // Only release if no exception. opFinishedShared(); // Return true and allow RedoDecoder to loop back. return true; }
@Override public boolean txnCommit(long txnId) throws IOException { TxnEntry te = getTxnEntry(txnId); // Allow side-effect free operations to be performed before acquiring latch. mOpLatch.acquireShared(); Latch latch = te.latch(); try { // Commit is expected to complete quickly, so don't let another // task thread run. Transaction txn = te.mTxn; try { txn.commit(); } finally { txn.exit(); } } finally { latch.releaseExclusive(); } // Only release if no exception. opFinishedShared(); // Return true and allow RedoDecoder to loop back. return true; }
@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(); } }
@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(); } }