public abstract class JtaTransactionPolicy extends java.lang.Object implements TransactionPolicy
TransactionPolicy.TransactionSynchronization
Modifier and Type | Field and Description |
---|---|
protected static Logger |
logger |
protected TransactionManager |
transactionManager |
protected TransactionType |
transactionType |
protected static Logger |
txLogger |
Constructor and Description |
---|
JtaTransactionPolicy(TransactionType transactionType,
TransactionManager transactionManager) |
Modifier and Type | Method and Description |
---|---|
protected Transaction |
beginTransaction() |
protected void |
completeTransaction(Transaction tx) |
void |
enlistResource(javax.transaction.xa.XAResource xaResource)
Enlists a XAResource in the actual active transaction.
|
protected void |
fireNonTransactionalCompletion() |
abstract Transaction |
getCurrentTransaction() |
java.lang.Object |
getResource(java.lang.Object key)
Gets a resource associated with the specified key.
|
protected Transaction |
getTransaction() |
TransactionType |
getTransactionType()
Gets the TransactionType for this policy.
|
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.
|
protected void |
resumeTransaction(Transaction tx) |
protected void |
rollbackTransaction(Transaction tx) |
void |
setRollbackOnly()
Sets this TransactionPolicy to rollback when completed
|
void |
setRollbackOnly(java.lang.Throwable reason)
Sets this TransactionPolicy to rollback when completed
|
protected void |
setRollbackOnly(Transaction tx,
java.lang.Throwable reason) |
protected Transaction |
suspendTransaction() |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
commit, isClientTransaction, isNewTransaction
protected static final Logger logger
protected static final Logger txLogger
protected final TransactionType transactionType
protected final TransactionManager transactionManager
public JtaTransactionPolicy(TransactionType transactionType, TransactionManager transactionManager)
public TransactionType getTransactionType()
TransactionPolicy
getTransactionType
in interface TransactionPolicy
public abstract Transaction getCurrentTransaction()
public boolean isTransactionActive()
TransactionPolicy
isTransactionActive
in interface TransactionPolicy
public boolean isRollbackOnly()
TransactionPolicy
isRollbackOnly
in interface TransactionPolicy
public void setRollbackOnly()
TransactionPolicy
setRollbackOnly
in interface TransactionPolicy
public void setRollbackOnly(java.lang.Throwable reason)
TransactionPolicy
setRollbackOnly
in interface TransactionPolicy
public java.lang.Object getResource(java.lang.Object key)
TransactionPolicy
getResource
in interface TransactionPolicy
key
- the resource keypublic void putResource(java.lang.Object key, java.lang.Object value)
TransactionPolicy
putResource
in interface TransactionPolicy
key
- the resource keyvalue
- the resourcepublic java.lang.Object removeResource(java.lang.Object key)
TransactionPolicy
removeResource
in interface TransactionPolicy
key
- the resource keypublic void registerSynchronization(TransactionPolicy.TransactionSynchronization synchronization)
TransactionPolicy
registerSynchronization
in interface TransactionPolicy
synchronization
- the transaction synchronization listenerprotected void fireNonTransactionalCompletion()
public void enlistResource(javax.transaction.xa.XAResource xaResource) throws SystemException
TransactionPolicy
enlistResource
in interface TransactionPolicy
xaResource
- the XAResource to enlistSystemException
- if the xaResource could not be enlisted in the
transactionpublic java.lang.String toString()
toString
in class java.lang.Object
protected Transaction getTransaction() throws SystemException
SystemException
protected void setRollbackOnly(Transaction tx, java.lang.Throwable reason)
protected Transaction beginTransaction() throws SystemException
SystemException
protected Transaction suspendTransaction() throws SystemException
SystemException
protected void resumeTransaction(Transaction tx) throws SystemException
SystemException
protected void completeTransaction(Transaction tx) throws SystemException, ApplicationException
SystemException
ApplicationException
protected void rollbackTransaction(Transaction tx) throws SystemException
SystemException