Interface TransactionSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession

public interface TransactionSession extends OsidSession

The transaction session is coordinate transactions. A transaction session allows for Transactions to be added to the list of transactions it is managing. Upon a commit() , all registered transactions receive a prepare() and a commit() . Upon an abort() all registered transactions receive an abort() . A TransactionSession itself may implement transactions (as it is an OsidSession ) as a means of enabling a form of federated transaction management.

  • Method Details

    • add

      Adds a Transaction to be managed by this transaction service.
      Parameters:
      transaction - the transaction to add
      Throws:
      AlreadyExistsException - transaction already added
      IllegalStateException - this transaction has ended
      InvalidArgumentException - the session doesn't support transactions
      NullArgumentException - a null argument provided
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • commit

      Commits the transaction and makes the state change(s) visible. This transaction is effectively closed and the only valid method that may be invoked is getState() .
      Throws:
      IllegalStateException - this transaction has been committed or aborted
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
      Notes:
      {@code - prepare()} should be invoked on all regstered transactions and iff all are successful should {@code commit()} be invoked on all registered transactions. In case of error on any {@code prepare()} , all transactions should be aborted. If an error occurs on a {@code commit()} after a transaction reported success on a {@code prepare()} after one or more transactions were already committed, then it is not ACID compliant and success should be assumed by committing the rest of the transactions. If a {@code commit()} error occurs when no transactions have been committed, then this operation should not proceed.
    • abort

      void abort()
      Cancels this transaction, rolling back the queue of operations since the start of this transaction. This transaction is effectively closed and the only valid method that may be invoked is getState() .
      Throws:
      IllegalStateException - this transaction has been committed or aborted
      Compliance:
      mandatory - This method must be implemented.
      Notes:
      Invokes - {@code abort()} on all registered transactions().
    • getState

      TransactionState getState()
      Gets the current state of this transaction.
      Returns:
      the current state of this transaction
      Throws:
      IllegalStateException - this transaction has been committed or aborted
      Compliance:
      mandatory - This method must be implemented.