TransactionSynchronization implementation that manages a
resource object bound through TransactionSynchronizationManager.
| Modifier and Type | Field and Description |
|---|---|
| private volatile boolean | |
| private final K | |
| private final O | |
| private final TransactionSynchronizationManager |
| Access | Constructor and Description |
|---|---|
| public | ReactiveResourceSynchronization(O
the resource object to manage resourceObject, K the key to bind the resource object for resourceKey, TransactionSynchronizationManager the synchronization manager bound to the current transaction synchronizationManager)Create a new ReactiveResourceSynchronization for the given holder. |
| Modifier and Type | Method and Description |
|---|---|
| public Mono | afterCommit()
Overrides default org. |
| public Mono | afterCompletion(int
completion status according to the status)STATUS_* constantsOverrides default org. |
| public Mono | beforeCommit(boolean
whether the transaction is defined as read-only transaction readOnly)Overrides default org. |
| public Mono | beforeCompletion()
Overrides default org. |
| protected Mono | cleanupResource(O
the resource holder to process resourceHolder, K the key that the resource object was bound for resourceKey, boolean whether the transaction has committed ( committed)true)
or rolled back (false)Perform a cleanup on the given resource (which is left bound to the thread). |
| protected Mono | processResourceAfterCommit(O
the resource holder to process resourceHolder)After-commit callback for the given resource holder. |
| protected Mono | releaseResource(O
the resource holder to process resourceHolder, K the key that the resource object was bound for resourceKey)Release the given resource (after it has been unbound from the thread). |
| public Mono | resume()
Overrides default org. |
| protected boolean | shouldReleaseAfterCompletion(O resourceHolder)
Return whether this holder's resource should be released after
transaction completion ( |
| protected boolean | shouldReleaseBeforeCompletion()
Return whether this holder's resource should be released before
transaction completion ( |
| protected boolean | shouldUnbindAtCompletion()
Return whether this holder should be unbound at completion (or should rather be left bound to the thread after the transaction). |
| public Mono | suspend()
Overrides default org. |
| holderActive | back to summary |
|---|---|
| private volatile boolean holderActive | |
| resourceKey | back to summary |
|---|---|
| private final K resourceKey | |
| resourceObject | back to summary |
|---|---|
| private final O resourceObject | |
| synchronizationManager | back to summary |
|---|---|
| private final TransactionSynchronizationManager synchronizationManager | |
| ReactiveResourceSynchronization | back to summary |
|---|---|
| public ReactiveResourceSynchronization(O resourceObject, K resourceKey, TransactionSynchronizationManager synchronizationManager) Create a new ReactiveResourceSynchronization for the given holder.
| |
| afterCommit | back to summary |
|---|---|
| public Mono Overrides default org. Doc from org. Invoked after transaction commit. Can perform further operations right after the main transaction has successfully committed. Can e.g. commit further operations that are supposed to follow on a successful commit of the main transaction, like confirmation messages or emails. Note The transaction will have been committed already, but the
transactional resources might still be active and accessible. As a consequence,
any data access code triggered at this point will still "participate" in the
original transaction, allowing to perform some cleanup (with no commit following
anymore!), unless it explicitly declares that it needs to run in a separate
transaction. Hence: Use
| |
| afterCompletion | back to summary |
|---|---|
| public Mono Overrides default org. Doc from org. Invoked after transaction commit/rollback. Can perform resource cleanup after transaction completion. Note The transaction will have been committed or rolled back already,
but the transactional resources might still be active and accessible. As a
consequence, any data access code triggered at this point will still "participate"
in the original transaction, allowing to perform some cleanup (with no commit
following anymore!), unless it explicitly declares that it needs to run in a
separate transaction. Hence: Use
| |
| beforeCommit | back to summary |
|---|---|
| public Mono Overrides default org. Doc from org. Invoked before transaction commit (before "beforeCompletion"). This callback does not mean that the transaction will actually be committed. A rollback decision can still occur after this method has been called. This callback is rather meant to perform work that's only relevant if a commit still has a chance to happen, such as flushing SQL statements to the database. Note that exceptions will get propagated to the commit caller and cause a rollback of the transaction.
| |
| beforeCompletion | back to summary |
|---|---|
| public Mono Overrides default org. Doc from org. Invoked before transaction commit/rollback. Can perform resource cleanup before transaction completion. This method will be invoked after
| |
| cleanupResource | back to summary |
|---|---|
| protected Mono Perform a cleanup on the given resource (which is left bound to the thread).
| |
| processResourceAfterCommit | back to summary |
|---|---|
| protected Mono After-commit callback for the given resource holder.
Only called when the resource hasn't been released yet
(
| |
| releaseResource | back to summary |
|---|---|
| protected Mono Release the given resource (after it has been unbound from the thread).
| |
| resume | back to summary |
|---|---|
| public Mono Overrides default org. Doc from org. Resume this synchronization. Supposed to rebind resources to TransactionSynchronizationManager if managing any.
| |
| shouldReleaseAfterCompletion | back to summary |
|---|---|
| protected boolean shouldReleaseAfterCompletion(O resourceHolder) Return whether this holder's resource should be released after
transaction completion ( The default implementation returns
| |
| shouldReleaseBeforeCompletion | back to summary |
|---|---|
| protected boolean shouldReleaseBeforeCompletion() Return whether this holder's resource should be released before
transaction completion ( Note that resources will only be released when they are
unbound from the thread ( The default implementation returns
| |
| shouldUnbindAtCompletion | back to summary |
|---|---|
| protected boolean shouldUnbindAtCompletion() Return whether this holder should be unbound at completion (or should rather be left bound to the thread after the transaction). The default implementation returns | |
| suspend | back to summary |
|---|---|
| public Mono Overrides default org. Doc from org. Suspend this synchronization. Supposed to unbind resources from TransactionSynchronizationManager if managing any.
| |