Txn
- Transaction implementationpublic abstract class TransactionManager<Txn>
extends java.lang.Object
Constructor and Description |
---|
TransactionManager() |
TransactionManager(TransactionMonitor monitor) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
abortTxn(Txn txn)
Aborts and closes the given internal transaction.
|
protected void |
attachNotification(Txn txn)
Called to notify internal method that transaction is attached.
|
void |
close(boolean suspend)
Closes all transaction scopes.
|
protected abstract boolean |
commitTxn(Txn txn)
Commits and closes the given internal transaction.
|
protected abstract Txn |
createTxn(Txn parent,
IsolationLevel level)
Creates an internal transaction representation, with the optional parent
transaction.
|
protected Txn |
createTxn(Txn parent,
IsolationLevel level,
int timeout,
java.util.concurrent.TimeUnit unit)
Creates an internal transaction representation, with the optional parent
transaction.
|
TransactionScope<Txn> |
detachLocalScope()
Detaches the thread-local TransactionScope from the current thread.
|
protected void |
detachNotification(Txn txn)
Called to notify internal method that transaction is detached.
|
boolean |
isClosed() |
TransactionScope<Txn> |
localScope()
Returns the thread-local TransactionScope, creating it if needed.
|
protected void |
reuseTxn(Txn txn)
Called when a transaction is about to be reused.
|
protected abstract IsolationLevel |
selectIsolationLevel(Transaction parent,
IsolationLevel level)
Returns supported isolation level, which may be higher.
|
protected void |
setForUpdate(Txn txn,
boolean forUpdate)
Called when the Transaction.setForUpdate method is called.
|
protected abstract boolean |
supportsForUpdate()
Return true if transactions support "for update" mode.
|
public TransactionManager()
public TransactionManager(TransactionMonitor monitor)
public TransactionScope<Txn> localScope()
public TransactionScope<Txn> detachLocalScope()
attached
later, and to any thread
which does not currently have a TransactionScope.public void close(boolean suspend) throws RepositoryException
suspend
- when true, indefinitely suspend all threads interacting
with transactionsRepositoryException
public boolean isClosed()
protected abstract IsolationLevel selectIsolationLevel(Transaction parent, IsolationLevel level)
parent
- optional parent transactionlevel
- desired isolation level (may be null)protected abstract boolean supportsForUpdate()
protected abstract Txn createTxn(Txn parent, IsolationLevel level) throws java.lang.Exception
parent
- optional parent transactionlevel
- required isolation leveljava.lang.Exception
protected Txn createTxn(Txn parent, IsolationLevel level, int timeout, java.util.concurrent.TimeUnit unit) throws java.lang.Exception
The default implementation of this method just calls the regular createTxn method, ignoring the timeout parameter.
parent
- optional parent transactionlevel
- required isolation leveltimeout
- desired timeout for lock acquisition, never negativeunit
- timeout unit, never nulljava.lang.Exception
protected void reuseTxn(Txn txn) throws java.lang.Exception
txn
- transaction to reuse, never nulljava.lang.Exception
protected void setForUpdate(Txn txn, boolean forUpdate)
protected void attachNotification(Txn txn)
txn
- transaction that is attached, could be null if none existsprotected void detachNotification(Txn txn)
txn
- transaction that is dettached, could be null if none existsprotected abstract boolean commitTxn(Txn txn) throws PersistException
PersistException
protected abstract void abortTxn(Txn txn) throws PersistException
PersistException
Copyright © 2006-2013 Amazon Technologies, Inc.. All Rights Reserved.