Class TransactionalSupport
java.lang.Object
org.springframework.data.couchbase.core.TransactionalSupport
Utility methods to support transactions.
- Author:
- Graham Pople
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic reactor.core.publisher.Mono<Optional<CouchbaseResourceHolder>>
Returns non-empty iff in a transaction.static RuntimeException
retryTransactionOnCasMismatch
(com.couchbase.client.core.transaction.CoreTransactionAttemptContext ctx, long cas1, long cas2) static reactor.core.publisher.Mono<Void>
verifyNotInTransaction
(String methodName)
-
Constructor Details
-
TransactionalSupport
public TransactionalSupport()
-
-
Method Details
-
checkForTransactionInThreadLocalStorage
public static reactor.core.publisher.Mono<Optional<CouchbaseResourceHolder>> checkForTransactionInThreadLocalStorage()Returns non-empty iff in a transaction. It determines this from thread-local storage and/or reactive context.The user could be doing a reactive operation (with .block()) inside a blocking transaction (like @Transactional). Or a blocking operation inside a ReactiveTransactionsWrapper transaction (which would be a bad idea). So, need to check both thread-local storage and reactive context.
-
verifyNotInTransaction
-
retryTransactionOnCasMismatch
public static RuntimeException retryTransactionOnCasMismatch(com.couchbase.client.core.transaction.CoreTransactionAttemptContext ctx, long cas1, long cas2)
-