com.caucho.transaction
Class TransactionImpl

com.caucho.transaction.TransactionImpl
All Implemented Interfaces:
AlarmListener, java.util.EventListener

public class TransactionImpl
implements AlarmListener

Implementation of the transaction. Transactions are normally associated with a single thread.


Method Summary
 void close()
          Close the transaction, rolling back everything and removing all enlisted resources.
 void commit()
          Commit the transaction.
 boolean delistResource(com.caucho.transaction.XAResource resource, int flag)
          delists a resource from the current transaction
 boolean enlistResource(com.caucho.transaction.XAResource resource)
          enlists a resource with the current transaction
 int getStatus()
          Returns the status of this transaction
 void handleAlarm(Alarm alarm)
          Handles a callback from an alarm.
 void registerSynchronization(com.caucho.transaction.Synchronization sync)
          Register a synchronization callback
 void rollback()
          Rollback the transaction.
 void setRollbackOnly()
          Force any completion to be a rollback.
 void setTransactionTimeout(int seconds)
          sets the timeout for the transaction
 

Method Detail

enlistResource

public boolean enlistResource(com.caucho.transaction.XAResource resource)
                       throws com.caucho.transaction.RollbackException,
                              com.caucho.transaction.SystemException
enlists a resource with the current transaction
Returns:
true if successful

delistResource

public boolean delistResource(com.caucho.transaction.XAResource resource,
                              int flag)
                       throws com.caucho.transaction.SystemException
delists a resource from the current transaction
Parameters:
resource - the resource to delist
flag - XXX: ???
Returns:
true if successful

getStatus

public int getStatus()
              throws com.caucho.transaction.SystemException
Returns the status of this transaction

registerSynchronization

public void registerSynchronization(com.caucho.transaction.Synchronization sync)
Register a synchronization callback

setRollbackOnly

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

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.

setTransactionTimeout

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

handleAlarm

public void handleAlarm(Alarm alarm)
Description copied from interface: AlarmListener
Handles a callback from an alarm.
Specified by:
handleAlarm in interface AlarmListener

close

public void close()
Close the transaction, rolling back everything and removing all enlisted resources.