Package org.infinispan.commons.tx
Class TransactionManagerImpl
- java.lang.Object
-
- org.infinispan.commons.tx.TransactionManagerImpl
-
- All Implemented Interfaces:
TransactionManager
- Direct Known Subclasses:
EmbeddedBaseTransactionManager
public abstract class TransactionManagerImpl extends Object implements TransactionManager
A simpleTransactionManager
implementation.It provides the basic to handle
Transaction
s 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 UUID
transactionManagerId
-
Constructor Summary
Constructors Constructor Description TransactionManagerImpl()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
begin()
void
commit()
protected abstract Transaction
createTransaction()
static void
dissociateTransaction()
int
getStatus()
Transaction
getTransaction()
void
resume(Transaction tx)
void
rollback()
void
setRollbackOnly()
void
setTransactionTimeout(int seconds)
Transaction
suspend()
-
-
-
Field Detail
-
transactionManagerId
protected final UUID transactionManagerId
-
-
Method Detail
-
dissociateTransaction
public static void dissociateTransaction()
-
getTransaction
public Transaction getTransaction()
- Specified by:
getTransaction
in interfaceTransactionManager
-
begin
public void begin() throws NotSupportedException, SystemException
- Specified by:
begin
in interfaceTransactionManager
- Throws:
NotSupportedException
SystemException
-
commit
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException
- Specified by:
commit
in interfaceTransactionManager
- Throws:
RollbackException
HeuristicMixedException
HeuristicRollbackException
SecurityException
IllegalStateException
SystemException
-
rollback
public void rollback() throws IllegalStateException, SecurityException, SystemException
- Specified by:
rollback
in interfaceTransactionManager
- Throws:
IllegalStateException
SecurityException
SystemException
-
setRollbackOnly
public void setRollbackOnly() throws IllegalStateException, SystemException
- Specified by:
setRollbackOnly
in interfaceTransactionManager
- Throws:
IllegalStateException
SystemException
-
getStatus
public int getStatus() throws SystemException
- Specified by:
getStatus
in interfaceTransactionManager
- Throws:
SystemException
-
setTransactionTimeout
public void setTransactionTimeout(int seconds) throws SystemException
- Specified by:
setTransactionTimeout
in interfaceTransactionManager
- Throws:
SystemException
-
suspend
public Transaction suspend() throws SystemException
- Specified by:
suspend
in interfaceTransactionManager
- Throws:
SystemException
-
resume
public void resume(Transaction tx) throws InvalidTransactionException, IllegalStateException, SystemException
- Specified by:
resume
in interfaceTransactionManager
- Throws:
InvalidTransactionException
IllegalStateException
SystemException
-
createTransaction
protected abstract Transaction createTransaction()
-
-