com.atomikos.icatch.jta
Class TransactionManagerImp

java.lang.Object
  extended by com.atomikos.icatch.jta.TransactionManagerImp
All Implemented Interfaces:
SubTxAwareParticipant, Referenceable, TransactionManager, UserTransaction

public class TransactionManagerImp
extends Object
implements TransactionManager, SubTxAwareParticipant, Referenceable, UserTransaction

The main JTA transaction manager singleton.


Field Summary
static String JTA_PROPERTY_NAME
          Transaction property name to indicate that the transaction is a JTA transaction.
 
Method Summary
 void begin()
          Creates a new transaction and associate it with the current thread.
 void begin(int timeout)
          Custom begin to guarantee a timeout value through an argument.
 void commit()
           
 void committed(CompositeTransaction tx)
           
static boolean getDefaultSerial()
          Gets the default mode for new txs.
static int getDefaultTimeout()
          Get the default timeout value.
 Reference getReference()
           
 int getStatus()
           
 Transaction getTransaction()
           
 Transaction getTransaction(String tid)
          Gets any previous transaction with the given identifier.
static TransactionManager getTransactionManager()
          Gets the installed transaction manager, if any.
 int getTransactionTimeout()
           
static void installTransactionManager(CompositeTransactionManager ctm, boolean automaticResourceRegistration)
          Install a transaction manager.
 void resume(Transaction tobj)
           
 void rollback()
           
 void rolledback(CompositeTransaction tx)
           
static void setDefaultSerial(boolean value)
          Sets the default serial mode for new txs.
static void setDefaultTimeout(int defaultTimeoutValueInSeconds)
          Set the default transaction timeout value.
 void setRollbackOnly()
           
 void setTransactionTimeout(int seconds)
           
 Transaction suspend()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JTA_PROPERTY_NAME

public static final String JTA_PROPERTY_NAME
Transaction property name to indicate that the transaction is a JTA transaction. If this property is set to an arbitrary non-null value then a JTA transaction is assumed by this class. This property is used for detecting incompatible existing transactions: if a transaction exists without this property then the begin method will suspend it (and resume afterwards).

See Also:
Constant Field Values
Method Detail

setDefaultSerial

public static void setDefaultSerial(boolean value)
Sets the default serial mode for new txs.

Parameters:
value - If true, then new txs will be set to serial mode.

getDefaultSerial

public static boolean getDefaultSerial()
Gets the default mode for new txs.

Returns:
boolean If true, then new txs started through here will be in serial mode.

setDefaultTimeout

public static void setDefaultTimeout(int defaultTimeoutValueInSeconds)
Set the default transaction timeout value.

Parameters:
defaultTimeoutValueInSeconds - the default transaction timeout value in seconds.

getDefaultTimeout

public static int getDefaultTimeout()
Get the default timeout value.

Returns:
the default transaction timeout value in seconds.

installTransactionManager

public static void installTransactionManager(CompositeTransactionManager ctm,
                                             boolean automaticResourceRegistration)
Install a transaction manager.

Parameters:
ctm - The composite transaction manager to use.
automaticResourceRegistration - If true, then unknown XAResource instances should lead to the addition of a new temporary resource. If false, then unknown resources will lead to an exception.

getTransactionManager

public static TransactionManager getTransactionManager()
Gets the installed transaction manager, if any.

Returns:
TransactionManager The installed instance, null if none.

getTransaction

public Transaction getTransaction(String tid)
Gets any previous transaction with the given identifier.

Returns:
Transaction The instance, or null if not found.

begin

public void begin()
           throws NotSupportedException,
                  SystemException
Creates a new transaction and associate it with the current thread. If the current thread already has a transaction, then a local subtransaction will be created.

Specified by:
begin in interface TransactionManager
Specified by:
begin in interface UserTransaction
Throws:
NotSupportedException
SystemException

begin

public void begin(int timeout)
           throws NotSupportedException,
                  SystemException
Custom begin to guarantee a timeout value through an argument.

Throws:
NotSupportedException
SystemException

getTransaction

public Transaction getTransaction()
                           throws SystemException
Specified by:
getTransaction in interface TransactionManager
Throws:
SystemException
See Also:
TransactionManager

setTransactionTimeout

public void setTransactionTimeout(int seconds)
                           throws SystemException
Specified by:
setTransactionTimeout in interface TransactionManager
Specified by:
setTransactionTimeout in interface UserTransaction
Throws:
SystemException
See Also:
TransactionManager

getTransactionTimeout

public int getTransactionTimeout()

suspend

public Transaction suspend()
                    throws SystemException
Specified by:
suspend in interface TransactionManager
Throws:
SystemException
See Also:
TransactionManager

resume

public void resume(Transaction tobj)
            throws InvalidTransactionException,
                   IllegalStateException,
                   SystemException
Specified by:
resume in interface TransactionManager
Throws:
InvalidTransactionException
IllegalStateException
SystemException
See Also:
TransactionManager

getStatus

public int getStatus()
              throws SystemException
Specified by:
getStatus in interface TransactionManager
Specified by:
getStatus in interface UserTransaction
Throws:
SystemException
See Also:
TransactionManager

commit

public void commit()
            throws RollbackException,
                   HeuristicMixedException,
                   HeuristicRollbackException,
                   SystemException,
                   IllegalStateException,
                   SecurityException
Specified by:
commit in interface TransactionManager
Specified by:
commit in interface UserTransaction
Throws:
RollbackException
HeuristicMixedException
HeuristicRollbackException
SystemException
IllegalStateException
SecurityException
See Also:
TransactionManager

rollback

public void rollback()
              throws IllegalStateException,
                     SystemException,
                     SecurityException
Specified by:
rollback in interface TransactionManager
Specified by:
rollback in interface UserTransaction
Throws:
IllegalStateException
SystemException
SecurityException
See Also:
TransactionManager

setRollbackOnly

public void setRollbackOnly()
                     throws IllegalStateException,
                            SystemException
Specified by:
setRollbackOnly in interface TransactionManager
Specified by:
setRollbackOnly in interface UserTransaction
Throws:
IllegalStateException
SystemException
See Also:
TransactionManager

committed

public void committed(CompositeTransaction tx)
Specified by:
committed in interface SubTxAwareParticipant
See Also:
SubTxAwareParticipant

rolledback

public void rolledback(CompositeTransaction tx)
Specified by:
rolledback in interface SubTxAwareParticipant
See Also:
SubTxAwareParticipant

getReference

public Reference getReference()
                       throws NamingException
Specified by:
getReference in interface Referenceable
Throws:
NamingException
See Also:
Referenceable.getReference()


Copyright © 2016. All Rights Reserved.