Class AbstractTransactionService
- java.lang.Object
-
- org.exoplatform.services.transaction.impl.AbstractTransactionService
-
- All Implemented Interfaces:
TransactionService
- Direct Known Subclasses:
JBossTransactionService,TransactionsEssentialsTransactionService
public abstract class AbstractTransactionService extends Object implements TransactionService
This abstract class implements the main logic of all the methods expected for aTransactionService. If you intend to use aTransactionManagerin standalone mode (not manager by your Application Server), you can set the transaction timeout thanks to thevalue-paramcalledtimeoutthe value of this parameter is expressed in seconds.- Version:
- $Id$
- Author:
- Nicolas Filotto
-
-
Field Summary
Fields Modifier and Type Field Description protected intdefaultTimeoutThe default timeoutprotected booleanforceTimeoutIndicates if the timeout has to be enforced
-
Constructor Summary
Constructors Constructor Description AbstractTransactionService()AbstractTransactionService(org.exoplatform.container.xml.InitParams params)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleandelistResource(XAResource xares)Delists XA resource from transaction manager.booleanenlistResource(XAResource xares)Enlists XA resource in transaction manager.protected abstract TransactionManagerfindTransactionManager()This method will try to find the currentTransactionManagerprotected UserTransactionfindUserTransaction()This method will try to find the currentUserTransaction, by default it will simply wraps aTransactionManagerintgetDefaultTimeout()TransactionManagergetTransactionManager()UserTransactiongetUserTransaction()protected booleanisTMInitialized()Indicates whether or not theTransactionManagerhas been initializedvoidsetTransactionTimeout(int seconds)Sets timeout in seconds,
-
-
-
Method Detail
-
delistResource
public boolean delistResource(XAResource xares) throws RollbackException, SystemException
Delists XA resource from transaction manager.- Specified by:
delistResourcein interfaceTransactionService- Parameters:
xares- XAResource- Returns:
- true if the resource was delisted successfully; otherwise false.
- Throws:
SystemException- Thrown if the transaction manager encounters an unexpected error condition.RollbackException
-
enlistResource
public boolean enlistResource(XAResource xares) throws RollbackException, SystemException
Enlists XA resource in transaction manager.- Specified by:
enlistResourcein interfaceTransactionService- Parameters:
xares- XAResource- Returns:
- true if the resource was enlisted successfully; otherwise false.
- Throws:
RollbackException- Thrown to indicate that the transaction has been marked for rollback only.SystemException- Thrown if the transaction manager encounters an unexpected error condition.
-
getDefaultTimeout
public int getDefaultTimeout()
- Specified by:
getDefaultTimeoutin interfaceTransactionService- Returns:
- default timeout in seconds
-
getTransactionManager
public final TransactionManager getTransactionManager()
- Specified by:
getTransactionManagerin interfaceTransactionService- Returns:
- TransactionManager
-
isTMInitialized
protected boolean isTMInitialized()
Indicates whether or not theTransactionManagerhas been initialized
-
findTransactionManager
protected abstract TransactionManager findTransactionManager() throws Exception
This method will try to find the currentTransactionManager- Returns:
- the current
TransactionManager - Throws:
Exception- if an error occurs while looking for theTransactionManager
-
getUserTransaction
public final UserTransaction getUserTransaction()
- Specified by:
getUserTransactionin interfaceTransactionService- Returns:
- UserTransaction
-
findUserTransaction
protected UserTransaction findUserTransaction() throws Exception
This method will try to find the currentUserTransaction, by default it will simply wraps aTransactionManager- Returns:
- the current
UserTransaction - Throws:
Exception- if an error occurs while looking for theUserTransaction
-
setTransactionTimeout
public void setTransactionTimeout(int seconds) throws SystemExceptionSets timeout in seconds,- Specified by:
setTransactionTimeoutin interfaceTransactionService- Parameters:
seconds- int- Throws:
SystemException
-
-