Package org.infinispan.commons.tx
Class TransactionManagerImpl
java.lang.Object
org.infinispan.commons.tx.TransactionManagerImpl
- All Implemented Interfaces:
javax.transaction.TransactionManager
- Direct Known Subclasses:
EmbeddedBaseTransactionManager
,RemoteTransactionManager
public abstract class TransactionManagerImpl
extends Object
implements javax.transaction.TransactionManager
A simple
TransactionManager
implementation.
It provides the basic to handle Transaction
s and supports any XAResource
.
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
begin()
void
commit()
protected abstract javax.transaction.Transaction
static void
int
javax.transaction.Transaction
void
resume
(javax.transaction.Transaction tx) void
rollback()
void
void
setTransactionTimeout
(int seconds) javax.transaction.Transaction
suspend()
-
Field Details
-
transactionManagerId
-
-
Constructor Details
-
TransactionManagerImpl
public TransactionManagerImpl()
-
-
Method Details
-
dissociateTransaction
public static void dissociateTransaction() -
getTransaction
public javax.transaction.Transaction getTransaction()- Specified by:
getTransaction
in interfacejavax.transaction.TransactionManager
-
begin
public void begin() throws javax.transaction.NotSupportedException, javax.transaction.SystemException- Specified by:
begin
in interfacejavax.transaction.TransactionManager
- Throws:
javax.transaction.NotSupportedException
javax.transaction.SystemException
-
commit
public void commit() throws javax.transaction.RollbackException, javax.transaction.HeuristicMixedException, javax.transaction.HeuristicRollbackException, SecurityException, IllegalStateException, javax.transaction.SystemException- Specified by:
commit
in interfacejavax.transaction.TransactionManager
- Throws:
javax.transaction.RollbackException
javax.transaction.HeuristicMixedException
javax.transaction.HeuristicRollbackException
SecurityException
IllegalStateException
javax.transaction.SystemException
-
rollback
public void rollback() throws IllegalStateException, SecurityException, javax.transaction.SystemException- Specified by:
rollback
in interfacejavax.transaction.TransactionManager
- Throws:
IllegalStateException
SecurityException
javax.transaction.SystemException
-
setRollbackOnly
- Specified by:
setRollbackOnly
in interfacejavax.transaction.TransactionManager
- Throws:
IllegalStateException
javax.transaction.SystemException
-
getStatus
public int getStatus() throws javax.transaction.SystemException- Specified by:
getStatus
in interfacejavax.transaction.TransactionManager
- Throws:
javax.transaction.SystemException
-
setTransactionTimeout
public void setTransactionTimeout(int seconds) throws javax.transaction.SystemException - Specified by:
setTransactionTimeout
in interfacejavax.transaction.TransactionManager
- Throws:
javax.transaction.SystemException
-
suspend
public javax.transaction.Transaction suspend() throws javax.transaction.SystemException- Specified by:
suspend
in interfacejavax.transaction.TransactionManager
- Throws:
javax.transaction.SystemException
-
resume
public void resume(javax.transaction.Transaction tx) throws javax.transaction.InvalidTransactionException, IllegalStateException, javax.transaction.SystemException - Specified by:
resume
in interfacejavax.transaction.TransactionManager
- Throws:
javax.transaction.InvalidTransactionException
IllegalStateException
javax.transaction.SystemException
-
createTransaction
protected abstract javax.transaction.Transaction createTransaction()
-