Enumerations



BNZTransactionStatus

Abstract: this enumeration lists all possible states a transaction can be in
enum BNZTransactionStatus {
  ACTIVE, //A transaction is associated with the target object and it is in the active state.
  COMMITTED, //A transaction is associated with the target object and it has been committed.
  COMMITTING, //A transaction is associated with the target object and it is in the process of committing.
  MARKED_ROLLBACK, //A transaction is associated with the target object and it has been marked for rollback, perhaps as a result of a setRollbackOnly operation.
  PREPARED, //A transaction is associated with the target object and it has been prepared.
  PREPARING, //A transaction is associated with the target object and it is in the process of preparing.
  ROLLED_BACK, //A transaction is associated with the target object and the outcome has been determined to be rollback.
  ROLLING_BACK, //A transaction is associated with the target object and it is in the process of rolling back.  
} ;

Every transaction is in a defined state at any time. It starts in state ACTIVE which means that new changes can be added to the transaction and it waits for being committed or rolled back.

During the process of committing, a transaction goes into COMMITTING state, and after the successful commit it is COMMITTED.

When it is in the process of rolling back it has state ROLLING_BACK and ROLLED_BACK after a finishing the rollback.

Before rolling back or committing, the transaction has to find out about which objects have to be informed about the transaction (the observers). This is done in the preparation phase. During finding all the observers, the transaction is in PREPARING, after finishing the search it is in PREPAERD. The preparation is done automatically during commit or rollback if needed, but it can be programmatically invoced before by calling prepare.

While a transaction is ACTIVE, it can be set to MARKED_ROLLBACK by calling setRollBackOnly. The transaction can then be used as if it was active, but the only possible outcome of a later commit is a rollback.


(Last Updated 8/31/2006)