public class AutoCloseTransactionDemarcation extends TransactionDemarcation implements java.lang.AutoCloseable
The following is a sample use:
try (AutoCloseTransactionDemarcation td = new AutoCloseTransactionDemarcation(getTransactionManager())) {
... code to execute within the transaction ...
td.setSuccess(true);
}
Created: December 06 2013
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
MANDATORY, NEVER, NOT_SUPPORTED, REQUIRED, REQUIRES_NEW, STATUS_CREATED_TRANSACTION_COMMITTED, STATUS_SUSPENDED_TRANSACTION_RESUMED, STATUS_TRANSACTION_CREATED, STATUS_TRANSACTION_ENDED_IN_CODE, SUPPORTS| Modifier | Constructor and Description |
|---|---|
protected |
AutoCloseTransactionDemarcation()
Create a new AutoCloseTransactionDemarcation that hasn't called
begin().
|
|
AutoCloseTransactionDemarcation(javax.transaction.TransactionManager pManager)
Create a new AutoCloseTransactionDemarcation that begins the
transaction with our default attribute (REQUIRED, unless
overridden).
|
|
AutoCloseTransactionDemarcation(javax.transaction.TransactionManager pManager,
int pTransactionAttribute)
Create a new AutoCloseTransactionDemarcation that begins the
transaction with specified transaction attribute.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close by calling end(!isSuccess()).
|
boolean |
isSuccess()
Returns property success.
|
void |
setSuccess(boolean pSuccess)
Sets property success.
|
begin, begin, end, end, equalTransactions, getDefaultTransactionAttribute, getTransaction, isTransactionCreated, setClearTransactionOnEndpublic AutoCloseTransactionDemarcation(javax.transaction.TransactionManager pManager)
throws TransactionDemarcationException
pManager - our transaction manager.TransactionDemarcationExceptionpublic AutoCloseTransactionDemarcation(javax.transaction.TransactionManager pManager,
int pTransactionAttribute)
throws TransactionDemarcationException
pManager - our transaction manager.pTransactionAttribute - the transaction attribute (such
as REQUIRED, REQUIRES_NEW, etc).TransactionDemarcationExceptionprotected AutoCloseTransactionDemarcation()
public void setSuccess(boolean pSuccess)
public boolean isSuccess()
public void close()
throws TransactionDemarcationException
close in interface java.lang.AutoCloseableTransactionDemarcationException