com.arjuna.mw.wst
Class TransactionManager

java.lang.Object
  extended bycom.arjuna.mw.wst.TransactionManager

public abstract class TransactionManager
extends java.lang.Object

This is the interface that the core exposes in order to allow different types of participants to be enrolled. The messaging layer continues to work in terms of the registrar, but internally we map to one of these methods. This could also be the interface that high-level users see (e.g., at the application Web Service). As with UserTransaction a TransactionManager does not represent a specific transaction, but rather is responsible for providing access to an implicit per-thread transaction context.

Since:
XTS 1.0.
Version:
$Id: TransactionManager.java,v 1.10.6.1 2005/11/22 10:36:06 kconner Exp $
Author:
Mark Little (mark.little@arjuna.com)

Constructor Summary
TransactionManager()
           
 
Method Summary
abstract  TxContext currentTransaction()
          The currentTransaction method returns the TxContext for the current transaction, or null if there is none.
abstract  void enlistForDurableTwoPhase(Durable2PCParticipant tpp, java.lang.String id)
          Enlist the specified participant with current transaction such that it will participate in the 2PC protocol; a unique identifier for the participant is also required.
abstract  void enlistForVolatileTwoPhase(Volatile2PCParticipant pzp, java.lang.String id)
          Enlist the specified participant with current transaction such that it will participate in the Volatile 2PC protocol; a unique identifier for the participant is also required.
static TransactionManager getTransactionManager()
          Get the transaction manager.
abstract  int replay()
           
abstract  void resume(TxContext txContext)
          The resume method can be used to (re-)associate a thread with a transaction(s) via its TxContext.
static void setTransactionManager(TransactionManager manager)
          Set the transaction manager.
abstract  TxContext suspend()
          A thread of control may require periods of non-transactionality so that it may perform work that is not associated with a specific transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionManager

public TransactionManager()
Method Detail

getTransactionManager

public static TransactionManager getTransactionManager()
Get the transaction manager.

Returns:
The transaction manager.

setTransactionManager

public static void setTransactionManager(TransactionManager manager)
Set the transaction manager.

Parameters:
manager - The transaction manager.

enlistForVolatileTwoPhase

public abstract void enlistForVolatileTwoPhase(Volatile2PCParticipant pzp,
                                               java.lang.String id)
                                        throws WrongStateException,
                                               UnknownTransactionException,
                                               AlreadyRegisteredException,
                                               SystemException
Enlist the specified participant with current transaction such that it will participate in the Volatile 2PC protocol; a unique identifier for the participant is also required. If there is no transaction associated with the invoking thread then the UnknownTransactionException exception is thrown. If the coordinator already has a participant enrolled with the same identifier, then AlreadyRegisteredException will be thrown. If the transaction is not in a state where participants can be enrolled (e.g., it is terminating) then WrongStateException will be thrown.

Throws:
WrongStateException
UnknownTransactionException
AlreadyRegisteredException
SystemException

enlistForDurableTwoPhase

public abstract void enlistForDurableTwoPhase(Durable2PCParticipant tpp,
                                              java.lang.String id)
                                       throws WrongStateException,
                                              UnknownTransactionException,
                                              AlreadyRegisteredException,
                                              SystemException
Enlist the specified participant with current transaction such that it will participate in the 2PC protocol; a unique identifier for the participant is also required. If there is no transaction associated with the invoking thread then the UnknownTransactionException exception is thrown. If the coordinator already has a participant enrolled with the same identifier, then AlreadyRegisteredException will be thrown. If the transaction is not in a state where participants can be enrolled (e.g., it is terminating) then WrongStateException will be thrown.

Throws:
WrongStateException
UnknownTransactionException
AlreadyRegisteredException
SystemException

replay

public abstract int replay()
                    throws SystemException
Throws:
SystemException

resume

public abstract void resume(TxContext txContext)
                     throws UnknownTransactionException,
                            SystemException
The resume method can be used to (re-)associate a thread with a transaction(s) via its TxContext. Prior to association, the thread is disassociated with any transaction(s) with which it may be currently associated. If the TxContext is null, then the thread is associated with no transaction. The UnknownTransactionException exception is thrown if the transaction that the TxContext refers to is invalid in the scope of the invoking thread.

Throws:
UnknownTransactionException
SystemException

suspend

public abstract TxContext suspend()
                           throws SystemException
A thread of control may require periods of non-transactionality so that it may perform work that is not associated with a specific transaction. In order to do this it is necessary to disassociate the thread from any transactions. The suspend method accomplishes this, returning a TxContext instance, which is a handle on the transaction. The thread is then no longer associated with any transaction.

Throws:
SystemException

currentTransaction

public abstract TxContext currentTransaction()
                                      throws SystemException
The currentTransaction method returns the TxContext for the current transaction, or null if there is none. Unlike suspend, this method does not disassociate the current thread from the transaction(s). This can be used to enable multiple threads to execute within the scope of the same transaction.

Throws:
SystemException