private LocalTransaction doNewTransaction(DurabilityMode durabilityMode) { RedoWriter redo = txnRedoWriter(); return new LocalTransaction (this, redo, durabilityMode, LockMode.UPGRADABLE_READ, mDefaultLockTimeoutNanos); }
/** * Convenience method which returns a transaction intended for locking and undo. Caller can * make modifications, but they won't go to the redo log. */ LocalTransaction newNoRedoTransaction() { RedoWriter redo = txnRedoWriter(); return new LocalTransaction (this, redo, DurabilityMode.NO_REDO, LockMode.UPGRADABLE_READ, -1); }
/** * Convenience method which returns a transaction intended for locking and undo. Caller can * make modifications, but they won't go to the redo log. */ LocalTransaction newNoRedoTransaction() { RedoWriter redo = txnRedoWriter(); return new LocalTransaction (this, redo, DurabilityMode.NO_REDO, LockMode.UPGRADABLE_READ, -1); }
private LocalTransaction newTransaction(long txnId) { LocalTransaction txn = new LocalTransaction (mDatabase, txnId, LockMode.UPGRADABLE_READ, INFINITE_TIMEOUT); txn.attach(ATTACHMENT); return txn; }
/** * Convenience method which returns a transaction intended for locking and undo. Caller can * make modifications, but they won't go to the redo log. * * @param redoTxnId non-zero if operation is performed by recovery */ LocalTransaction newNoRedoTransaction(long redoTxnId) { return redoTxnId == 0 ? newNoRedoTransaction() : new LocalTransaction(this, redoTxnId, LockMode.UPGRADABLE_READ, -1); }
private LocalTransaction doNewTransaction(DurabilityMode durabilityMode) { RedoWriter redo = txnRedoWriter(); return new LocalTransaction (this, redo, durabilityMode, LockMode.UPGRADABLE_READ, mDefaultLockTimeoutNanos); }
/** * Convenience method which returns a transaction intended for locking and undo. Caller can * make modifications, but they won't go to the redo log. * * @param redoTxnId non-zero if operation is performed by recovery */ LocalTransaction newNoRedoTransaction(long redoTxnId) { return redoTxnId == 0 ? newNoRedoTransaction() : new LocalTransaction(this, redoTxnId, LockMode.UPGRADABLE_READ, -1); }
private LocalTransaction doNewTransaction(DurabilityMode durabilityMode) { RedoWriter redo = txnRedoWriter(); return new LocalTransaction (this, redo, durabilityMode, LockMode.UPGRADABLE_READ, mDefaultLockTimeoutNanos); }
private LocalTransaction newTransaction(long txnId) { LocalTransaction txn = new LocalTransaction (mDatabase, txnId, LockMode.UPGRADABLE_READ, INFINITE_TIMEOUT); txn.attach(ATTACHMENT); return txn; }
/** * Convenience method which returns a transaction intended for locking and undo. Caller can * make modifications, but they won't go to the redo log. * * @param redoTxnId non-zero if operation is performed by recovery */ private LocalTransaction newNoRedoTransaction(long redoTxnId) { return redoTxnId == 0 ? newNoRedoTransaction() : new LocalTransaction(this, redoTxnId, LockMode.UPGRADABLE_READ, mDefaultLockTimeoutNanos); }
@Override public boolean txnEnter(long txnId) throws IOException { LocalTransaction txn = txn(txnId); if (txn == null) { txn = new LocalTransaction(mDatabase, txnId, LockMode.UPGRADABLE_READ, 0L); mTransactions.insert(txnId).value = txn; } else { txn.enter(); } return true; }
@Override public boolean txnEnter(long txnId) throws IOException { LocalTransaction txn = txn(txnId); if (txn == null) { txn = new LocalTransaction(mDatabase, txnId, LockMode.UPGRADABLE_READ, 0L); mTransactions.insert(txnId).value = txn; } else { txn.enter(); } return true; }
@Override public boolean txnEnter(long txnId) throws IOException { LocalTransaction txn = txn(txnId); if (txn == null) { txn = new LocalTransaction(mDatabase, txnId, LockMode.UPGRADABLE_READ, 0L); mTransactions.insert(txnId).value = txn; } else { txn.enter(); } return true; }
/** * @return TxnEntry with scrambled transaction id */ private TxnEntry getTxnEntry(long txnId) throws IOException { long scrambledTxnId = scramble(txnId); TxnEntry e = mTransactions.get(scrambledTxnId); if (e == null) { // Create transaction on demand if necessary. Startup transaction recovery only // applies to those which generated undo log entries. LocalTransaction txn = new LocalTransaction (mDatabase, txnId, LockMode.UPGRADABLE_READ, INFINITE_TIMEOUT); e = mTransactions.insert(scrambledTxnId); e.init(txn, selectLatch(scrambledTxnId)); } return e; }
LocalTransaction txn = new LocalTransaction (mDatabase, mTxnId, lockMode, timeoutNanos,
LocalTransaction txn = new LocalTransaction (mDatabase, mTxnId, lockMode, timeoutNanos,
LocalTransaction txn = new LocalTransaction (mDatabase, mTxnId, lockMode, timeoutNanos, hasState);
@Override public boolean txnEnter(long txnId) throws IOException { // Reduce hash collisions. long scrambledTxnId = scramble(txnId); TxnEntry e = mTransactions.get(scrambledTxnId); // Allow side-effect free operations to be performed before acquiring latch. mOpLatch.acquireShared(); if (e == null) { LocalTransaction txn = new LocalTransaction (mDatabase, txnId, LockMode.UPGRADABLE_READ, INFINITE_TIMEOUT); mTransactions.insert(scrambledTxnId).init(txn, selectLatch(scrambledTxnId)); // Only release if no exception. opFinishedShared(); return true; } Latch latch = e.latch(); try { // Cheap operation, so don't let another task thread run. e.mTxn.enter(); } finally { latch.releaseExclusive(); } // Only release if no exception. opFinishedShared(); // Return true and allow RedoDecoder to loop back. return true; }
txn = new LocalTransaction (mDatabase, txnId, LockMode.UPGRADABLE_READ, INFINITE_TIMEOUT);