Class AbstractTransactionService
java.lang.Object
org.exoplatform.services.transaction.impl.AbstractTransactionService
- All Implemented Interfaces:
TransactionService
- Direct Known Subclasses:
JBossTransactionService,TransactionsEssentialsTransactionService
This abstract class implements the main logic of all the methods expected for a
TransactionService. If you intend to use a TransactionManager in
standalone mode (not manager by your Application Server), you can set the
transaction timeout thanks to the value-param called timeout
the value of this parameter is expressed in seconds.- Version:
- $Id$
- Author:
- Nicolas Filotto
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intThe default timeoutprotected final booleanIndicates if the timeout has to be enforced -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandelistResource(XAResource xares) Delists XA resource from transaction manager.booleanenlistResource(XAResource xares) Enlists XA resource in transaction manager.protected abstract javax.transaction.TransactionManagerThis method will try to find the currentTransactionManagerprotected javax.transaction.UserTransactionThis method will try to find the currentUserTransaction, by default it will simply wraps aTransactionManagerintfinal javax.transaction.TransactionManagerfinal javax.transaction.UserTransactionprotected booleanIndicates whether or not theTransactionManagerhas been initializedvoidsetTransactionTimeout(int seconds) Sets timeout in seconds,
-
Field Details
-
defaultTimeout
protected final int defaultTimeoutThe default timeout -
forceTimeout
protected final boolean forceTimeoutIndicates if the timeout has to be enforced
-
-
Constructor Details
-
AbstractTransactionService
public AbstractTransactionService() -
AbstractTransactionService
public AbstractTransactionService(org.exoplatform.container.xml.InitParams params)
-
-
Method Details
-
delistResource
public boolean delistResource(XAResource xares) throws javax.transaction.RollbackException, javax.transaction.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:
javax.transaction.SystemException- Thrown if the transaction manager encounters an unexpected error condition.javax.transaction.RollbackException
-
enlistResource
public boolean enlistResource(XAResource xares) throws javax.transaction.RollbackException, javax.transaction.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:
javax.transaction.RollbackException- Thrown to indicate that the transaction has been marked for rollback only.javax.transaction.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 javax.transaction.TransactionManager getTransactionManager()- Specified by:
getTransactionManagerin interfaceTransactionService- Returns:
- TransactionManager
-
isTMInitialized
protected boolean isTMInitialized()Indicates whether or not theTransactionManagerhas been initialized -
findTransactionManager
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 javax.transaction.UserTransaction getUserTransaction()- Specified by:
getUserTransactionin interfaceTransactionService- Returns:
- UserTransaction
-
findUserTransaction
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 javax.transaction.SystemException Sets timeout in seconds,- Specified by:
setTransactionTimeoutin interfaceTransactionService- Parameters:
seconds- int- Throws:
javax.transaction.SystemException
-