Class JTATransactionServiceImpl
- java.lang.Object
-
- org.bonitasoft.engine.transaction.JTATransactionServiceImpl
-
- All Implemented Interfaces:
TransactionService,UserTransactionService
public class JTATransactionServiceImpl extends java.lang.Object implements TransactionService
-
-
Constructor Summary
Constructors Modifier Constructor Description JTATransactionServiceImpl(javax.transaction.TransactionManager txManager)protectedJTATransactionServiceImpl(javax.transaction.TransactionManager txManager, XAResourceRetriever xaResourceRetriever)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbegin()Create a new transaction and associate it with the current thread.voidcomplete()Complete the transaction : either commit or rollback.<T> TexecuteInTransaction(java.util.concurrent.Callable<T> callable)Execute the given callable inside a transaction.longgetNumberOfActiveTransactions()Get the number of active transactions (i.e.java.util.Optional<java.lang.Boolean>hasMultipleResources()booleanisRollbackOnly()booleanisTransactionActive()voidregisterBeforeCommitCallable(java.util.concurrent.Callable<java.lang.Void> callable)voidregisterBonitaSynchronization(javax.transaction.Synchronization txSync)Register a synchronization object for the transaction currently associated with the target object.voidsetRollbackOnly()Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.
-
-
-
Constructor Detail
-
JTATransactionServiceImpl
public JTATransactionServiceImpl(javax.transaction.TransactionManager txManager)
-
JTATransactionServiceImpl
protected JTATransactionServiceImpl(javax.transaction.TransactionManager txManager, XAResourceRetriever xaResourceRetriever)
-
-
Method Detail
-
begin
public void begin() throws STransactionCreationExceptionDescription copied from interface:TransactionServiceCreate a new transaction and associate it with the current thread.- Specified by:
beginin interfaceTransactionService- Throws:
STransactionCreationException
-
complete
public void complete() throws STransactionCommitException, STransactionRollbackExceptionDescription copied from interface:TransactionServiceComplete the transaction : either commit or rollback.- Specified by:
completein interfaceTransactionService- Throws:
STransactionCommitExceptionSTransactionRollbackException
-
isTransactionActive
public boolean isTransactionActive()
- Specified by:
isTransactionActivein interfaceUserTransactionService
-
setRollbackOnly
public void setRollbackOnly() throws STransactionExceptionDescription copied from interface:TransactionServiceModify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.- Specified by:
setRollbackOnlyin interfaceTransactionService- Throws:
STransactionException- Thrown if the transaction manager encounters an unexpected error condition.
-
isRollbackOnly
public boolean isRollbackOnly() throws STransactionException- Specified by:
isRollbackOnlyin interfaceTransactionService- Throws:
STransactionException
-
registerBonitaSynchronization
public void registerBonitaSynchronization(javax.transaction.Synchronization txSync) throws STransactionNotFoundExceptionDescription copied from interface:UserTransactionServiceRegister a synchronization object for the transaction currently associated with the target object. The transaction manager invokes the beforeCompletion method prior to starting the two-phase transaction commit process. After the transaction is completed, the transaction manager invokes the afterCompletion method.- Specified by:
registerBonitaSynchronizationin interfaceUserTransactionService- Parameters:
txSync- The Synchronization object for the transaction associated with the target object.- Throws:
STransactionNotFoundException- Thrown if the transaction manager encounters an unexpected error condition.
-
registerBeforeCommitCallable
public void registerBeforeCommitCallable(java.util.concurrent.Callable<java.lang.Void> callable) throws STransactionNotFoundException- Specified by:
registerBeforeCommitCallablein interfaceUserTransactionService- Throws:
STransactionNotFoundException
-
executeInTransaction
public <T> T executeInTransaction(java.util.concurrent.Callable<T> callable) throws java.lang.ExceptionDescription copied from interface:UserTransactionServiceExecute the given callable inside a transaction.- Specified by:
executeInTransactionin interfaceUserTransactionService- Returns:
- Throws:
java.lang.Exception
-
getNumberOfActiveTransactions
public long getNumberOfActiveTransactions()
Description copied from interface:TransactionServiceGet the number of active transactions (i.e. transactions that opened but not yet completed or rolledback). A transaction that was just mark as "rollbackOnly" is considered as an active one.- Specified by:
getNumberOfActiveTransactionsin interfaceTransactionService- Returns:
- the number of active transactions
-
hasMultipleResources
public java.util.Optional<java.lang.Boolean> hasMultipleResources()
- Specified by:
hasMultipleResourcesin interfaceUserTransactionService
-
-