public interface TransactionPolicy
Modifier and Type | Interface and Description |
---|---|
static interface |
TransactionPolicy.TransactionSynchronization
TransactionSynchronization receives notifications as the Transaction
completes.
|
Modifier and Type | Method and Description |
---|---|
void |
commit()
Commits or rolls back this TransactionPolicy.
|
void |
enlistResource(javax.transaction.xa.XAResource xaResource)
Enlists a XAResource in the actual active transaction.
|
java.lang.Object |
getResource(java.lang.Object key)
Gets a resource associated with the specified key.
|
TransactionType |
getTransactionType()
Gets the TransactionType for this policy.
|
boolean |
isClientTransaction()
Is this policy running in an inhreited transaction? Some
TransactionTypes, such as Required or Supported, use the caller's
transaction instead of starting a new transaction.
|
boolean |
isNewTransaction()
Is this a new transaction and not an inhreited transaction or no transaction? Some
TransactionTypes, such as Required or Supported, use the caller's
transaction instead of starting a new transaction.
|
boolean |
isRollbackOnly()
If true, this TransactionPolicy will ultimately end with rollback.
|
boolean |
isTransactionActive()
Is there a actual transaction active?
|
void |
putResource(java.lang.Object key,
java.lang.Object value)
Associates the specified resource with the specified key.
|
void |
registerSynchronization(TransactionPolicy.TransactionSynchronization synchronization)
Registers a listener for transaction synchronization events.
|
java.lang.Object |
removeResource(java.lang.Object key)
Removes and returns the resource associated with the specified key.
|
void |
setRollbackOnly()
Sets this TransactionPolicy to rollback when completed
|
void |
setRollbackOnly(java.lang.Throwable reason)
Sets this TransactionPolicy to rollback when completed
|
TransactionType getTransactionType()
boolean isNewTransaction()
boolean isClientTransaction()
boolean isTransactionActive()
boolean isRollbackOnly()
void setRollbackOnly()
void setRollbackOnly(java.lang.Throwable reason)
void commit() throws ApplicationException, SystemException
ApplicationException
- if recoverable exception is encounteredSystemException
- if an unrecoverable exception is encounteredjava.lang.Object getResource(java.lang.Object key)
key
- the resource keyvoid putResource(java.lang.Object key, java.lang.Object value)
key
- the resource keyvalue
- the resourcejava.lang.Object removeResource(java.lang.Object key)
key
- the resource keyvoid registerSynchronization(TransactionPolicy.TransactionSynchronization synchronization)
synchronization
- the transaction synchronization listenervoid enlistResource(javax.transaction.xa.XAResource xaResource) throws SystemException
xaResource
- the XAResource to enlistSystemException
- if the xaResource could not be enlisted in the
transaction