com.caucho.transaction
Class TransactionManagerImpl

com.caucho.transaction.TransactionManagerImpl

public class TransactionManagerImpl

Implementation of the transactin manager.


Constructor Summary
TransactionManagerImpl()
           
 
Method Summary
 void begin()
          Create a new transaction and associate it with the thread.
 void commit()
          Commit the transaction.
static void delistResource(com.caucho.transaction.XAResource resource)
          Remove a resource to the list of resources managed by the transaction.
static void enlistResource(com.caucho.transaction.XAResource resource)
          Adds a resource to the list of resources managed by the transaction.
static TransactionImpl getCurrentTransaction()
          Returns the current transaction for this thread.
static com.caucho.transaction.XAResource getResource(java.lang.Object key)
          Gets the resource attached to the key.
 int getStatus()
          Returns the transaction's status
 com.caucho.transaction.Transaction getTransaction()
          Returns the transaction for the current thread.
static com.caucho.transaction.TransactionManager getTransactionManager()
          Return the TransactionManagerImpl singleton.
static com.caucho.transaction.UserTransaction getUserTransaction()
          Return the TransactionManagerImpl singleton.
static void putResource(java.lang.Object key, com.caucho.transaction.XAResource resource)
          Adds a resource to the map of keyed resources.
 void resume(com.caucho.transaction.Transaction tobj)
          Resume the transaction.
 void rollback()
          Rollback the transaction.
 void setRollbackOnly()
          Force any completion to be a rollback.
 void setTransactionTimeout(int seconds)
          sets the timeout for the transaction
 com.caucho.transaction.Transaction suspend()
          Suspend the transaction.
 java.lang.String toString()
           
 

Constructor Detail

TransactionManagerImpl

public TransactionManagerImpl()
Method Detail

begin

public void begin()
           throws com.caucho.transaction.NotSupportedException,
                  com.caucho.transaction.SystemException
Create a new transaction and associate it with the thread.

getTransaction

public com.caucho.transaction.Transaction getTransaction()
                                                  throws com.caucho.transaction.SystemException
Returns the transaction for the current thread.

suspend

public com.caucho.transaction.Transaction suspend()
                                           throws com.caucho.transaction.SystemException
Suspend the transaction.

resume

public void resume(com.caucho.transaction.Transaction tobj)
            throws javax.transaction.InvalidTransactionException,
                   com.caucho.transaction.SystemException
Resume the transaction.

setRollbackOnly

public void setRollbackOnly()
                     throws com.caucho.transaction.SystemException
Force any completion to be a rollback.

getStatus

public int getStatus()
              throws com.caucho.transaction.SystemException
Returns the transaction's status

setTransactionTimeout

public void setTransactionTimeout(int seconds)
                           throws com.caucho.transaction.SystemException
sets the timeout for the transaction

commit

public void commit()
            throws com.caucho.transaction.RollbackException,
                   com.caucho.transaction.HeuristicMixedException,
                   com.caucho.transaction.HeuristicRollbackException,
                   com.caucho.transaction.SystemException
Commit the transaction.

rollback

public void rollback()
Rollback the transaction.

getCurrentTransaction

public static TransactionImpl getCurrentTransaction()
Returns the current transaction for this thread.

getTransactionManager

public static com.caucho.transaction.TransactionManager getTransactionManager()
Return the TransactionManagerImpl singleton.

getUserTransaction

public static com.caucho.transaction.UserTransaction getUserTransaction()
Return the TransactionManagerImpl singleton.

enlistResource

public static void enlistResource(com.caucho.transaction.XAResource resource)
                           throws com.caucho.transaction.SystemException,
                                  com.caucho.transaction.RollbackException
Adds a resource to the list of resources managed by the transaction.

delistResource

public static void delistResource(com.caucho.transaction.XAResource resource)
                           throws com.caucho.transaction.SystemException,
                                  com.caucho.transaction.RollbackException
Remove a resource to the list of resources managed by the transaction. Until the commit() or rollback(), the resource will still be owned by the transaction.

putResource

public static void putResource(java.lang.Object key,
                               com.caucho.transaction.XAResource resource)
Adds a resource to the map of keyed resources. This map lets resource managers like the DataSource manager to use the same connection for all the requests in a transaction.

getResource

public static com.caucho.transaction.XAResource getResource(java.lang.Object key)
Gets the resource attached to the key.

toString

public java.lang.String toString()