Class JtaTransactionCoordinatorImpl
java.lang.Object
org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorImpl
- All Implemented Interfaces:
SynchronizationCallbackTarget,TransactionCoordinator
public class JtaTransactionCoordinatorImpl
extends Object
implements TransactionCoordinator, SynchronizationCallbackTarget
An implementation of TransactionCoordinator based on managing a transaction through the JTA API (either TM or UT)
- Author:
- Steve Ebersole
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassImplementation of the LocalInflow for this TransactionCoordinator.Nested classes/interfaces inherited from interface org.hibernate.resource.transaction.spi.TransactionCoordinator
TransactionCoordinator.TransactionDriver -
Constructor Summary
ConstructorsConstructorDescriptionJtaTransactionCoordinatorImpl(TransactionCoordinatorBuilder transactionCoordinatorBuilder, TransactionCoordinatorOwner owner, boolean autoJoinTransactions, JtaPlatform jtaPlatform, boolean preferUserTransactions, boolean performJtaThreadTracking, TransactionObserver... observers) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddObserver(TransactionObserver observer) Adds an observer to the coordinator.voidafterCompletion(boolean successful, boolean delayed) Callback of after-completion.voidCallback of before-completion.Retrieve an isolation delegate appropriate for this transaction strategy.voidIndicates an explicit request to join a transaction.Get access to the local registry of Synchronization instancesintAccess to the builder that generated this coordinatorGet the delegate used by the local transaction driver to control the underlying transactionvoidbooleanisActive()Is this transaction still active?booleanisJoined()Determine if there is an active transaction that this coordinator is already joined to.booleanbooleanIs the RegisteredSynchronization used by Hibernate for unified JTA Synchronization callbacks registered for this coordinator?voidpulse()Used by owner of the "JDBC session" as a means to indicate that implicit joining should be done if needed.voidremoveObserver(TransactionObserver observer) Remove an observer from the coordinator.voidsetTimeOut(int seconds) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.resource.transaction.spi.TransactionCoordinator
isTransactionActive, isTransactionActive
-
Constructor Details
-
JtaTransactionCoordinatorImpl
public JtaTransactionCoordinatorImpl(TransactionCoordinatorBuilder transactionCoordinatorBuilder, TransactionCoordinatorOwner owner, boolean autoJoinTransactions, JtaPlatform jtaPlatform, boolean preferUserTransactions, boolean performJtaThreadTracking, TransactionObserver... observers)
-
-
Method Details
-
getSynchronizationCallbackCoordinator
-
pulse
public void pulse()Description copied from interface:TransactionCoordinatorUsed by owner of the "JDBC session" as a means to indicate that implicit joining should be done if needed.- Specified by:
pulsein interfaceTransactionCoordinator
-
explicitJoin
public void explicitJoin()Description copied from interface:TransactionCoordinatorIndicates an explicit request to join a transaction. This is mainly intended to handle the JPA requirement aroundEntityManager.joinTransaction(), and generally speaking only has an impact in JTA environments- Specified by:
explicitJoinin interfaceTransactionCoordinator
-
isJoined
public boolean isJoined()Description copied from interface:TransactionCoordinatorDetermine if there is an active transaction that this coordinator is already joined to.- Specified by:
isJoinedin interfaceTransactionCoordinator- Returns:
trueif there is an active transaction this coordinator is already joined to;falseotherwise.
-
isSynchronizationRegistered
public boolean isSynchronizationRegistered()Is the RegisteredSynchronization used by Hibernate for unified JTA Synchronization callbacks registered for this coordinator?- Returns:
trueindicates that a RegisteredSynchronization is currently registered for this coordinator;falseindicates it is not (yet) registered.
-
getTransactionCoordinatorOwner
-
getJpaCompliance
- Specified by:
getJpaCompliancein interfaceTransactionCoordinator
-
getTransactionDriverControl
Description copied from interface:TransactionCoordinatorGet the delegate used by the local transaction driver to control the underlying transaction- Specified by:
getTransactionDriverControlin interfaceTransactionCoordinator- Returns:
- The control delegate.
-
getLocalSynchronizations
Description copied from interface:TransactionCoordinatorGet access to the local registry of Synchronization instances- Specified by:
getLocalSynchronizationsin interfaceTransactionCoordinator- Returns:
- The local Synchronization registry
-
isActive
public boolean isActive()Description copied from interface:TransactionCoordinatorIs this transaction still active?Answers on a best-effort basis. For example, in the case of JDBC based transactions we cannot know that a transaction is active when it is initiated directly through the JDBC
Connection, only when it is initiated from here.- Specified by:
isActivein interfaceSynchronizationCallbackTarget- Specified by:
isActivein interfaceTransactionCoordinator- Returns:
trueif the transaction is still active;falseotherwise.
-
isJtaTransactionCurrentlyActive
public boolean isJtaTransactionCurrentlyActive() -
createIsolationDelegate
Description copied from interface:TransactionCoordinatorRetrieve an isolation delegate appropriate for this transaction strategy.- Specified by:
createIsolationDelegatein interfaceTransactionCoordinator- Returns:
- An isolation delegate.
-
getTransactionCoordinatorBuilder
Description copied from interface:TransactionCoordinatorAccess to the builder that generated this coordinator- Specified by:
getTransactionCoordinatorBuilderin interfaceTransactionCoordinator
-
setTimeOut
public void setTimeOut(int seconds) - Specified by:
setTimeOutin interfaceTransactionCoordinator
-
getTimeOut
public int getTimeOut()- Specified by:
getTimeOutin interfaceTransactionCoordinator
-
invalidate
public void invalidate()- Specified by:
invalidatein interfaceTransactionCoordinator
-
beforeCompletion
public void beforeCompletion()Description copied from interface:SynchronizationCallbackTargetCallback of before-completion.- Specified by:
beforeCompletionin interfaceSynchronizationCallbackTarget- See Also:
-
afterCompletion
public void afterCompletion(boolean successful, boolean delayed) Description copied from interface:SynchronizationCallbackTargetCallback of after-completion.- Specified by:
afterCompletionin interfaceSynchronizationCallbackTarget- Parameters:
successful- Was the transaction successful?- See Also:
-
addObserver
Description copied from interface:TransactionCoordinatorAdds an observer to the coordinator.Observers are not to be cleared on transaction completion.
- Specified by:
addObserverin interfaceTransactionCoordinator- Parameters:
observer- The observer to add.
-
removeObserver
Description copied from interface:TransactionCoordinatorRemove an observer from the coordinator.- Specified by:
removeObserverin interfaceTransactionCoordinator- Parameters:
observer- The observer to remove.
-