Home

xl2.transaction
Class AbstractTransaction

java.lang.Object
  |
  +--xl2.transaction.AbstractTransaction
All Implemented Interfaces:
Transaction
Direct Known Subclasses:
XL2Transaction

public class AbstractTransaction
extends java.lang.Object
implements Transaction

Skeletal implementation of the Transaction interface. Subclasses need only over-ride the following protected methods:


Fields inherited from interface xl2.transaction.Transaction
STATUS_ABORT_FAILED, STATUS_ABORTED, STATUS_ABORTING, STATUS_BEGINNING, STATUS_COMMITTED, STATUS_COMMITTING, STATUS_IN_PROGRESS, STATUS_INSTANTIATED, STATUS_MARKED_ABORT
 
Constructor Summary
AbstractTransaction()
           
 
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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTransaction

public AbstractTransaction()
Method Detail

abort

public void abort()
           throws AbortFailedException,
                  TransactionNotOpenException
Description copied from interface: Transaction
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.
Specified by:
abort in interface Transaction
Following copied from interface: xl2.transaction.Transaction
Throws:
AbortFailedException -  
TransactionNotOpenException -  

begin

public void begin()
           throws TransactionNotClosedException
Description copied from interface: Transaction
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.
Specified by:
begin in interface Transaction
Following copied from interface: xl2.transaction.Transaction
Throws:
TransactionNotClosedException -  

commit

public void commit()
            throws TransactionAbortedException,
                   TransactionNotOpenException
Description copied from interface: Transaction
Save the transaction state.
Specified by:
commit in interface Transaction
Following copied from interface: xl2.transaction.Transaction
Throws:
AbortedFailedException - If the transaction attempts to abort and an exception occurrs.
TransactionAbortedException - If an exeception occurs.
TransactionNotOpenException -  
See Also:
Transaction.isOpen()

getStatus

public int getStatus()
Description copied from interface: Transaction
See Transaction STATUS_??? fields.
Specified by:
getStatus in interface Transaction

isClosed

public boolean isClosed()
Description copied from interface: Transaction
True if the status aborted, committed, or instantiated.
Specified by:
isClosed in interface Transaction

isOpen

public boolean isOpen()
Description copied from interface: Transaction
True if the status is in progress or marked for abort.
Specified by:
isOpen in interface Transaction

join

public void join()
Description copied from interface: Transaction
Associates the calling thread to the transaction. A thread can be joined to at most one transaction at any given time.
Specified by:
join in interface Transaction
Following copied from interface: xl2.transaction.Transaction
See Also:
Transaction.leave()

leave

public void leave()
Description copied from interface: Transaction
Disassociates the calling thread from the transaction.
Specified by:
leave in interface Transaction
Following copied from interface: xl2.transaction.Transaction
See Also:
Transaction.join()

setAbortOnly

public void setAbortOnly()
                  throws TransactionNotOpenException
Description copied from interface: Transaction
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.
Specified by:
setAbortOnly in interface Transaction
Following copied from interface: xl2.transaction.Transaction
Throws:
TransactionNotOpenException -  

Home