Package org.infinispan.commons.tx
Class TransactionManagerImpl
- java.lang.Object
-
- org.infinispan.commons.tx.TransactionManagerImpl
-
- All Implemented Interfaces:
TransactionManager
- Direct Known Subclasses:
RemoteTransactionManager
public abstract class TransactionManagerImpl extends Object implements TransactionManager
A simpleTransactionManagerimplementation.It provides the basic to handle
Transactions and supports anyXAResource.Implementation notes:
- The state is kept in memory only.
- Does not support recover.
- Does not
support multi-thread transactions. Although it is possible to execute the transactions in multiple threads, this
transaction manager does not wait for them to complete. It is the application responsibility to wait before invoking
commit()orrollback() - The transaction should not block. It is no possible to
setTransactionTimeout(int)and this transaction manager won't rollback the transaction if it takes too long.
If you need any of the requirements above, please consider use another implementation.
Also, it does not implement any 1-phase-commit optimization.
- Since:
- 9.1
- Author:
- Bela Ban, Pedro Ruivo
-
-
Field Summary
Fields Modifier and Type Field Description protected UUIDtransactionManagerId
-
Constructor Summary
Constructors Constructor Description TransactionManagerImpl()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidbegin()voidcommit()protected abstract TransactioncreateTransaction()static voiddissociateTransaction()intgetStatus()TransactiongetTransaction()voidresume(Transaction tx)voidrollback()voidsetRollbackOnly()voidsetTransactionTimeout(int seconds)Transactionsuspend()
-
-
-
Field Detail
-
transactionManagerId
protected final UUID transactionManagerId
-
-
Method Detail
-
dissociateTransaction
public static void dissociateTransaction()
-
getTransaction
public Transaction getTransaction()
- Specified by:
getTransactionin interfaceTransactionManager
-
begin
public void begin() throws NotSupportedException, SystemException- Specified by:
beginin interfaceTransactionManager- Throws:
NotSupportedExceptionSystemException
-
commit
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException- Specified by:
commitin interfaceTransactionManager- Throws:
RollbackExceptionHeuristicMixedExceptionHeuristicRollbackExceptionSecurityExceptionIllegalStateExceptionSystemException
-
rollback
public void rollback() throws IllegalStateException, SecurityException, SystemException- Specified by:
rollbackin interfaceTransactionManager- Throws:
IllegalStateExceptionSecurityExceptionSystemException
-
setRollbackOnly
public void setRollbackOnly() throws IllegalStateException, SystemException- Specified by:
setRollbackOnlyin interfaceTransactionManager- Throws:
IllegalStateExceptionSystemException
-
getStatus
public int getStatus() throws SystemException- Specified by:
getStatusin interfaceTransactionManager- Throws:
SystemException
-
setTransactionTimeout
public void setTransactionTimeout(int seconds) throws SystemException- Specified by:
setTransactionTimeoutin interfaceTransactionManager- Throws:
SystemException
-
suspend
public Transaction suspend() throws SystemException
- Specified by:
suspendin interfaceTransactionManager- Throws:
SystemException
-
resume
public void resume(Transaction tx) throws InvalidTransactionException, IllegalStateException, SystemException
- Specified by:
resumein interfaceTransactionManager- Throws:
InvalidTransactionExceptionIllegalStateExceptionSystemException
-
createTransaction
protected abstract Transaction createTransaction()
-
-