Interface TransactionCoordinator
- All Known Implementing Classes:
JdbcResourceLocalTransactionCoordinatorImpl,JtaTransactionCoordinatorImpl
public interface TransactionCoordinator
Models the coordination of all transaction related flows.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceProvides the means for resource-local transactions (as transaction drivers) to control the underlying "physical transaction" currently associated with theTransactionCoordinator. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddObserver(TransactionObserver observer) Adds an observer to the coordinator.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 transactiondefault voidbooleanisActive()Is this transaction still active?booleanisJoined()Determine if there is an active transaction that this coordinator is already joined to.default booleanvoidpulse()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)
-
Method Details
-
getTransactionCoordinatorBuilder
TransactionCoordinatorBuilder getTransactionCoordinatorBuilder()Access to the builder that generated this coordinator -
getTransactionDriverControl
TransactionCoordinator.TransactionDriver getTransactionDriverControl()Get the delegate used by the local transaction driver to control the underlying transaction- Returns:
- The control delegate.
-
getLocalSynchronizations
SynchronizationRegistry getLocalSynchronizations()Get access to the local registry of Synchronization instances- Returns:
- The local Synchronization registry
-
getJpaCompliance
JpaCompliance getJpaCompliance() -
explicitJoin
void explicitJoin()Indicates 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 -
isJoined
boolean isJoined()Determine if there is an active transaction that this coordinator is already joined to.- Returns:
trueif there is an active transaction this coordinator is already joined to;falseotherwise.
-
pulse
void pulse()Used by owner of the "JDBC session" as a means to indicate that implicit joining should be done if needed. -
isActive
boolean isActive()Is 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.- Returns:
trueif the transaction is still active;falseotherwise.- Throws:
HibernateException- Indicates a problem checking the transaction status.
-
createIsolationDelegate
IsolationDelegate createIsolationDelegate()Retrieve an isolation delegate appropriate for this transaction strategy.- Returns:
- An isolation delegate.
-
addObserver
Adds an observer to the coordinator.Observers are not to be cleared on transaction completion.
- Parameters:
observer- The observer to add.
-
removeObserver
Remove an observer from the coordinator.- Parameters:
observer- The observer to remove.
-
setTimeOut
void setTimeOut(int seconds) -
getTimeOut
int getTimeOut() -
isTransactionActive
default boolean isTransactionActive() -
invalidate
default void invalidate()
-