public final class UESTransaction
extends java.lang.Object
UESTransaction tx = UESTransaction.begin();
try {
//...
// a business logic here
//...
// has to be last operation. Marks transaction to be commited.
tx.prepareCommit();
} finally {
// commit transaction. When exception occured and prepareCommit was not called or
// transaction is marked for rollback, rollback is called instead.
tx.commit();
}
Modifier and Type | Field and Description |
---|---|
private boolean |
doCommit
Flag if transaction should be commited.
|
private static java.lang.String |
FOO_TX_MANAGER
Name of foo transaction manager.
|
private TransactionContext |
txContext
Instance of transaction context.
|
private TransactionManager |
txManager
Instance of transaction manager.
|
Modifier | Constructor and Description |
---|---|
private |
UESTransaction()
Prepares transaction manager to manage transaction.
|
Modifier and Type | Method and Description |
---|---|
static UESTransaction |
begin()
Starts new transaction.
|
private void |
begin0()
Starts new transaction.
|
void |
commit()
Finishes the transaction.
|
static UESTransaction |
get()
Returns existing transaction or starts new one of transaction does not exist.
|
private void |
get0()
Obtains existing transaction or starts new one.
|
void |
prepareCommit()
Sets transaction status to COMMIT state.
|
void |
setRollbackOnly()
Marks transaction as rollback-only.
|
TransactionRTException
- In case starting of new transaction fails.TransactionRTException
- In case starting of new transaction fails.TransactionRTException
- In case starting of new transaction fails.TransactionRTException
- In case starting of new transaction fails.TransactionRTException
- In case commit (or rollback) of transaction commit fails.