Home

xl2.transaction
Interface Transaction

All Known Implementing Classes:
AbstractTransaction

public interface Transaction

Basic interface that defines the state boundries for a set of resoures.


Field Summary
static int STATUS_ABORT_FAILED
          Transaction aborted - closed state.
static int STATUS_ABORTED
          Transaction aborted - closed state.
static int STATUS_ABORTING
          Transaction in the process of aborting.
static int STATUS_BEGINNING
          Transaction in the process of beginning.
static int STATUS_COMMITTED
          Transaction has been committed - closed state.
static int STATUS_COMMITTING
          Transaction is committing.
static int STATUS_IN_PROGRESS
          Transaction is in progress and has not been marked STATUS_MARKED_ABORT - open state.
static int STATUS_INSTANTIATED
          Transaction has been constructed and not yet begun - closed state.
static int STATUS_MARKED_ABORT
          Transaction is in progress, and can only abort - open state.
 
Method Summary
 void abort()
          Rollback the transaction.
 void begin()
          Calling begin multiple times on the same transaction, without an intervening call to commit or abort, causes TransactionNotClosedException to be thrown on the second and subsequent calls.
 void commit()
          Save the transaction state.
 int getStatus()
          See Transaction STATUS_??? fields.
 boolean isClosed()
          True if the status aborted, committed, or instantiated.
 boolean isOpen()
          True if the status is in progress or marked for abort.
 void join()
          Associates the calling thread to the transaction.
 void leave()
          Disassociates the calling thread from the transaction.
 void setAbortOnly()
          Modifies the transaction such that the only possible outcome is to abort the transaction.
 

Field Detail

STATUS_ABORTED

public static final int STATUS_ABORTED
Transaction aborted - closed state.
See Also:
getStatus()

STATUS_ABORT_FAILED

public static final int STATUS_ABORT_FAILED
Transaction aborted - closed state.
See Also:
getStatus()

STATUS_ABORTING

public static final int STATUS_ABORTING
Transaction in the process of aborting.
See Also:
getStatus()

STATUS_BEGINNING

public static final int STATUS_BEGINNING
Transaction in the process of beginning.
See Also:
getStatus()

STATUS_COMMITTED

public static final int STATUS_COMMITTED
Transaction has been committed - closed state.
See Also:
getStatus()

STATUS_COMMITTING

public static final int STATUS_COMMITTING
Transaction is committing.
See Also:
getStatus()

STATUS_IN_PROGRESS

public static final int STATUS_IN_PROGRESS
Transaction is in progress and has not been marked STATUS_MARKED_ABORT - open state.
See Also:
getStatus()

STATUS_INSTANTIATED

public static final int STATUS_INSTANTIATED
Transaction has been constructed and not yet begun - closed state.
See Also:
getStatus()

STATUS_MARKED_ABORT

public static final int STATUS_MARKED_ABORT
Transaction is in progress, and can only abort - open state.
See Also:
getStatus()
Method Detail

abort

public void abort()
           throws AbortFailedException,
                  TransactionNotOpenException
Rollback the transaction. If an exception occurs while aborting the status of the transaction becomes STATUS_ABORT_FAILED. Only abort can be called if the status is STATUS_ABORT_FAILED.
Throws:
AbortFailedException -  
TransactionNotOpenException -  

begin

public void begin()
           throws TransactionNotClosedException
Calling begin multiple times on the same transaction, without an intervening call to commit or abort, causes TransactionNotClosedException to be thrown on the second and subsequent calls.
Throws:
TransactionNotClosedException -  

commit

public void commit()
            throws TransactionAbortedException,
                   TransactionNotOpenException
Save the transaction state.
Throws:
AbortedFailedException - If the transaction attempts to abort and an exception occurrs.
TransactionAbortedException - If an exeception occurs.
TransactionNotOpenException -  
See Also:
isOpen()

getStatus

public int getStatus()
See Transaction STATUS_??? fields.

isClosed

public boolean isClosed()
True if the status aborted, committed, or instantiated.

isOpen

public boolean isOpen()
True if the status is in progress or marked for abort.

join

public void join()
Associates the calling thread to the transaction. A thread can be joined to at most one transaction at any given time.
See Also:
leave()

leave

public void leave()
Disassociates the calling thread from the transaction.
See Also:
join()

setAbortOnly

public void setAbortOnly()
                  throws TransactionNotOpenException
Modifies the transaction such that the only possible outcome is to abort the transaction. This has no effect on the state of the transaction until commit() is called.
Throws:
TransactionNotOpenException -  

Home