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.
Modifier and Type | Method and Description |
---|---|
void |
abort()
Cancels this transaction, rolling back the queue of operations since
the start of this transaction.
|
void |
add(Transaction transaction)
Adds a Transaction to be managed by this transaction service.
|
void |
commit()
Commits the transaction and makes the state change(s) visible.
|
TransactionState |
getState()
Gets the current state of this transaction.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
void add(Transaction transaction) throws AlreadyExistsException, OperationFailedException, PermissionDeniedException
transaction
- the transaction to addAlreadyExistsException
- transaction already addedIllegalStateException
- this transaction has endedInvalidArgumentException
- the session doesn't support
transactionsNullArgumentException
- a null
argument
providedOperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void commit() throws OperationFailedException, PermissionDeniedException
getState().
IllegalStateException
- this transaction has been
committed or abortedOperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.
- prepare()
should be invoked on all regstered
transactions and iff all are successful should commit()
be invoked on all registered transactions. In case of
error on any prepare(),
all transactions should
be aborted. If an error occurs on a commit()
after a transaction reported success on a 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 commit()
error occurs when no transactions have been committed,
then this operation should not proceed. void abort()
getState().
IllegalStateException
- this transaction has been
committed or abortedmandatory
- This method must be implemented. Invokes
- abort()
on all registered
transactions(). TransactionState getState()
IllegalStateException
- this transaction has been
committed or abortedmandatory
- This method must be implemented.