eXo Kernel :: Component :: Common Service 2.5.0-Alpha2

org.exoplatform.services.transaction.impl
Class AbstractTransactionService

java.lang.Object
  extended by org.exoplatform.services.transaction.impl.AbstractTransactionService
All Implemented Interfaces:
TransactionService
Direct Known Subclasses:
JBossTransactionService, TransactionServiceJotmImpl, TransactionsEssentialsTransactionService

public abstract class AbstractTransactionService
extends Object
implements TransactionService

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
protected  int defaultTimeout
          The default timeout
protected  boolean forceTimeout
          Indicates if the timeout has to be enforced
 
Constructor Summary
AbstractTransactionService()
           
AbstractTransactionService(InitParams params)
           
 
Method Summary
 boolean delistResource(XAResource xares)
          Delists XA resource from transaction manager.
 boolean enlistResource(XAResource xares)
          Enlists XA resource in transaction manager.
protected abstract  TransactionManager findTransactionManager()
          This method will try to find the current TransactionManager
protected  UserTransaction findUserTransaction()
          This method will try to find the current UserTransaction, by default it will simply wraps a TransactionManager
 int getDefaultTimeout()
          
 TransactionManager getTransactionManager()
          
 UserTransaction getUserTransaction()
          
protected  boolean isTMInitialized()
          Indicates whether or not the TransactionManager has been initialized
 void setTransactionTimeout(int seconds)
          Sets timeout in seconds,
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultTimeout

protected final int defaultTimeout
The default timeout


forceTimeout

protected final boolean forceTimeout
Indicates if the timeout has to be enforced

Constructor Detail

AbstractTransactionService

public AbstractTransactionService()

AbstractTransactionService

public AbstractTransactionService(InitParams params)
Method Detail

delistResource

public boolean delistResource(XAResource xares)
                       throws RollbackException,
                              SystemException
Delists XA resource from transaction manager.

Specified by:
delistResource in interface TransactionService
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:
enlistResource in interface TransactionService
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:
getDefaultTimeout in interface TransactionService
Returns:
default timeout in seconds

getTransactionManager

public final TransactionManager getTransactionManager()

Specified by:
getTransactionManager in interface TransactionService
Returns:
TransactionManager

isTMInitialized

protected boolean isTMInitialized()
Indicates whether or not the TransactionManager has been initialized


findTransactionManager

protected abstract TransactionManager findTransactionManager()
                                                      throws Exception
This method will try to find the current TransactionManager

Returns:
the current TransactionManager
Throws:
Exception - if an error occurs while looking for the TransactionManager

getUserTransaction

public final UserTransaction getUserTransaction()

Specified by:
getUserTransaction in interface TransactionService
Returns:
UserTransaction

findUserTransaction

protected UserTransaction findUserTransaction()
                                       throws Exception
This method will try to find the current UserTransaction, by default it will simply wraps a TransactionManager

Returns:
the current UserTransaction
Throws:
Exception - if an error occurs while looking for the UserTransaction

setTransactionTimeout

public void setTransactionTimeout(int seconds)
                           throws SystemException
Sets timeout in seconds,

Specified by:
setTransactionTimeout in interface TransactionService
Parameters:
seconds - int
Throws:
SystemException

eXo Kernel :: Component :: Common Service 2.5.0-Alpha2

Copyright © 2013 eXo Platform SAS. All Rights Reserved.