Class JTAJCATransactionImpl
java.lang.Object
org.datanucleus.transaction.TransactionImpl
org.datanucleus.transaction.jta.JTAJCATransactionImpl
- All Implemented Interfaces:
Synchronization, Transaction
A transaction that is synchronised with a Java Transaction Service (JTA) transaction with JCA.
It is only used when using the JDO API within a JavaEE environment using the JCA adapter (i.e not for JPA).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TransactionManagerJTA TransactionManager.private TransactionJTA transaction we currently are synchronized with.private booleanFields inherited from class TransactionImpl
active, closed, committing, ec, rollbackOnly, serializeRead, txnMgrFields inherited from interface Transaction
TRANSACTION_ISOLATION_OPTION -
Constructor Summary
ConstructorsConstructorDescriptionJTAJCATransactionImpl(ExecutionContext ec, PropertyStore properties) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidafterCompletion(int status) Called by the transaction manager after the transaction is committed or rolled back.voidCalled by the transaction manager prior to the start of the two-phase transaction commit process.booleanSimilar to "isActive" except that it just returns the "active" flag whereas the isActive() method can also embody rejoining to underlying transactions.booleanisActive()Accessor for whether the transaction is active.private voidSynchronise our active state with that of the JTA transaction, if it exists.Methods inherited from class TransactionImpl
addTransactionEventListener, begin, bindTransactionEventListener, close, commit, end, flush, getBeginTime, getNontransactionalRead, getNontransactionalWrite, getNontransactionalWriteAutoCommit, getOptimistic, getOptions, getRestoreValues, getRetainValues, getRollbackOnly, getSerializeRead, getSynchronization, internalBegin, internalCommit, internalPostCommit, internalPreCommit, internalPreRollback, internalRollback, isCommitting, preFlush, releaseSavepoint, removeTransactionEventListener, rollback, rollbackToSavepoint, setNontransactionalRead, setNontransactionalWrite, setNontransactionalWriteAutoCommit, setOptimistic, setOption, setOption, setOption, setOption, setProperties, setRestoreValues, setRetainValues, setRollbackOnly, setSavepoint, setSerializeRead, setSynchronization
-
Field Details
-
jtaTM
JTA TransactionManager. -
jtaTx
JTA transaction we currently are synchronized with. Null when there is no JTA transaction active or not yet detected. -
markedForRollback
private boolean markedForRollback
-
-
Constructor Details
-
JTAJCATransactionImpl
Constructor.- Parameters:
ec- ExecutionContextproperties- Properties to use with the transaction
-
-
Method Details
-
getIsActive
public boolean getIsActive()Description copied from class:TransactionImplSimilar to "isActive" except that it just returns the "active" flag whereas the isActive() method can also embody rejoining to underlying transactions.- Specified by:
getIsActivein interfaceTransaction- Overrides:
getIsActivein classTransactionImpl- Returns:
- The "active" flag
-
isActive
public boolean isActive()Accessor for whether the transaction is active.- Specified by:
isActivein interfaceTransaction- Overrides:
isActivein classTransactionImpl- Returns:
- Whether the transaction is active.
-
joinTransaction
private void joinTransaction()Synchronise our active state with that of the JTA transaction, if it exists. Look for an active JTA transaction. If there is one, begin() ourselves and register synchronisation. We must poll because there is no way of getting notified of a newly begun transaction. -
beforeCompletion
public void beforeCompletion()Called by the transaction manager prior to the start of the two-phase transaction commit process.- Specified by:
beforeCompletionin interfaceSynchronization
-
afterCompletion
public void afterCompletion(int status) Called by the transaction manager after the transaction is committed or rolled back. Must be synchronised because some callers expect to be owner of this object's monitor (internalPostCommit() calls closeSQLConnection() which calls notifyAll()).- Specified by:
afterCompletionin interfaceSynchronization- Parameters:
status- The status
-