com.caucho.transaction
Class TransactionManagerImpl

com.caucho.transaction.TransactionManagerImpl
All Implemented Interfaces:
java.io.Serializable

public class TransactionManagerImpl
implements java.io.Serializable

Implementation of the transaction manager.

See Also:
Serialized Form

Constructor Summary
TransactionManagerImpl()
           
 
Method Summary
 void begin()
          Create a new transaction and associate it with the thread.
 void commit()
          Commit the transaction.
 void delistResource(com.caucho.transaction.XAResource resource)
          Remove a resource to the list of resources managed by the transaction.
 void enlistResource(com.caucho.transaction.XAResource resource)
          Adds a resource to the list of resources managed by the transaction.
 java.lang.Object 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.
 com.caucho.transaction.UserTransaction getUserTransaction()
          Returns the corresponding user transaction.
 void putResource(java.lang.Object key, java.lang.Object value)
          Adds a resource to the map of keyed resources.
 void removeResourceKey(java.lang.Object key)
          Removes a resource to the map of keyed resources.
 void resume(com.caucho.transaction.Transaction tobj)
          Resume the transaction.
 void rollback()
          Rollback the transaction.
 void setRandomSeed(long seed)
           
 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

setRandomSeed

public void setRandomSeed(long seed)

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.

enlistResource

public 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 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 void putResource(java.lang.Object key,
                        java.lang.Object value)
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.

removeResourceKey

public void removeResourceKey(java.lang.Object key)
Removes 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 java.lang.Object getResource(java.lang.Object key)
Gets the resource attached to the key.

getUserTransaction

public com.caucho.transaction.UserTransaction getUserTransaction()
Returns the corresponding user transaction.

toString

public java.lang.String toString()