Interface TransactionCoordinator
-
- All Known Implementing Classes:
JdbcResourceLocalTransactionCoordinatorImpl
,JtaTransactionCoordinatorImpl
public interface TransactionCoordinator
Models the coordination of all transaction related flows.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
TransactionCoordinator.TransactionDriver
Provides the means for resource-local transactions (as transaction drivers) to control the underlying "physical transaction" currently associated with theTransactionCoordinator
.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addObserver(TransactionObserver observer)
Adds an observer to the coordinator.IsolationDelegate
createIsolationDelegate()
Retrieve an isolation delegate appropriate for this transaction strategy.void
explicitJoin()
Indicates an explicit request to join a transaction.JpaCompliance
getJpaCompliance()
SynchronizationRegistry
getLocalSynchronizations()
Get access to the local registry of Synchronization instancesint
getTimeOut()
TransactionCoordinatorBuilder
getTransactionCoordinatorBuilder()
Access to the builder that generated this coordinatorTransactionCoordinator.TransactionDriver
getTransactionDriverControl()
Get the delegate used by the local transaction driver to control the underlying transactiondefault void
invalidate()
boolean
isActive()
Is this transaction still active?boolean
isJoined()
Determine if there is an active transaction that this coordinator is already joined to.default boolean
isTransactionActive()
default boolean
isTransactionActive(boolean isMarkedRollbackConsideredActive)
void
pulse()
Used by owner of the "JDBC session" as a means to indicate that implicit joining should be done if needed.void
removeObserver(TransactionObserver observer)
Remove an observer from the coordinator.void
setTimeOut(int seconds)
-
-
-
Method Detail
-
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:
true
if there is an active transaction this coordinator is already joined to;false
otherwise.
-
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:
true
if the transaction is still active;false
otherwise.- 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
void addObserver(TransactionObserver observer)
Adds an observer to the coordinator.Observers are not to be cleared on transaction completion.
- Parameters:
observer
- The observer to add.
-
removeObserver
void removeObserver(TransactionObserver observer)
Remove an observer from the coordinator.- Parameters:
observer
- The observer to remove.
-
setTimeOut
void setTimeOut(int seconds)
-
getTimeOut
int getTimeOut()
-
isTransactionActive
default boolean isTransactionActive()
-
isTransactionActive
default boolean isTransactionActive(boolean isMarkedRollbackConsideredActive)
-
invalidate
default void invalidate()
-
-