|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Transaction
Provides the transaction boundary while accessing a channel.
A Transaction instance is used to encompass channel access via the following idiom:
Channel ch = ...
Transaction tx = ch.getTransaction();
try {
tx.begin();
...
// ch.put(event) or ch.take()
...
tx.commit();
} catch (ChannelException ex) {
tx.rollback();
...
} finally {
tx.close();
}
Depending upon the implementation of the channel, the transaction semantics may be strong, or best-effort only.
Transactions must be thread safe. To provide a guarantee of thread safe
access to Transactions, see BasicChannelSemantics
and
BasicTransactionSemantics
.
Channel
Nested Class Summary | |
---|---|
static class |
Transaction.TransactionState
|
Method Summary | |
---|---|
void |
begin()
Starts a transaction boundary for the current channel operation. |
void |
close()
Ends a transaction boundary for the current channel operation. |
void |
commit()
Indicates that the transaction can be successfully committed. |
void |
rollback()
Indicates that the transaction can must be aborted. |
Method Detail |
---|
void begin()
Starts a transaction boundary for the current channel operation. If a transaction is already in progress, this method will join that transaction using reference counting.
Note: For every invocation of this method there must be a corresponding invocation of close() method. Failure to ensure this can lead to dangling transactions and unpredictable results.
void commit()
void rollback()
void close()
Ends a transaction boundary for the current channel operation. If a transaction is already in progress, this method will join that transaction using reference counting. The transaction is completed only if there are no more references left for this transaction.
Note: For every invocation of this method there must be a corresponding invocation of begin() method. Failure to ensure this can lead to dangling transactions and unpredictable results.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |