public interface CacheTransactionSynchronization
RegionFactory
is asked to create
(RegionFactory.createTransactionContext(org.hibernate.engine.spi.SharedSessionContractImplementor)
}) when a Hibernate Session
is created. It's lifecycle is that of the Session. It receives
"transactional event callbacks" around joining and completing resource
transactions.
This allows the cache impl to book-keep data related to current transaction,
such as and process it in unique ways. E.g. this allows an impl to perform
batch updates if Hibernate is configured to use JDBC-only transactions,
and therefore information cannot be retrieved from the JTA transaction
assigned to current thread.
While transactional semantics might be fully implemented by the cache
provider, Hibernate may require different transactional semantics: In order
to prevent inconsistent reads, 2LC should not expose entities that are
modified in any concurrently executing transactions, and force DB load
instead. Native transactional implementation may provide looser semantics
and 2LC implementation has to adapt to these.Modifier and Type | Method and Description |
---|---|
long |
getCurrentTransactionStartTimestamp()
What is the start time of this context object?
|
void |
transactionCompleted(boolean successful)
Callback that the underling resource transaction to which the owning
Session was joined is in the "completed" stage.
|
void |
transactionCompleting()
Callback that the underling resource transaction to which the owning
Session was joined is in the beginning stages of completing.
|
void |
transactionJoined()
Callback that owning Session has become joined to a resource transaction.
|
default void |
transactionResumed()
Currently not used.
|
default void |
transactionSuspended()
Currently not used.
|
long getCurrentTransactionStartTimestamp()
void transactionJoined()
void transactionCompleting()
void transactionCompleted(boolean successful)
successful
- Was the resource transaction successful?default void transactionSuspended()
default void transactionResumed()
Copyright © 2019 JBoss by Red Hat. All rights reserved.