public class ReactiveTransactionSynchronization extends Object
Supports a list of transactional resources if synchronization is active.
Resource management code should check for subscriber Context
-bound resources, e.g. R2DBC
Connections using TransactionResources.getResource(Class)
. Such code is normally not supposed to bind
resources, as this is the responsibility of transaction managers. A further option is to lazily bind on first use if
transaction synchronization is active, for performing transactions that span an arbitrary number of resources.
Transaction synchronization must be activated and deactivated by a transaction manager by registering
ReactiveTransactionSynchronization
in the subscriber context
.
Constructor and Description |
---|
ReactiveTransactionSynchronization() |
Modifier and Type | Method and Description |
---|---|
TransactionResources |
getCurrentTransaction() |
boolean |
isSynchronizationActive()
Return if transaction synchronization is active for the current
Context . |
void |
registerTransaction(TransactionResources transactionResources)
Create a new transaction span and register a
TransactionResources instance. |
void |
unregisterTransaction(TransactionResources transactionResources)
Unregister a transaction span and by removing
TransactionResources instance. |
public boolean isSynchronizationActive()
Context
. Can be called
before register to avoid unnecessary instance creation.public void registerTransaction(TransactionResources transactionResources)
TransactionResources
instance.transactionResources
- must not be null.public void unregisterTransaction(TransactionResources transactionResources)
TransactionResources
instance.transactionResources
- must not be null.@Nullable public TransactionResources getCurrentTransaction()
TransactionResources
or null if none is present.Copyright © 2018–2019 Pivotal Software, Inc.. All rights reserved.