Class ReadOnlyAndReadWriteTransactionConversionTemplate<T>
java.lang.Object
com.atlassian.confluence.impl.transaction.ReadOnlyAndReadWriteTransactionConversionTemplate<T>
Provides methods for changing between read/write and readonly transactions.
- Since:
- 9.0
-
Constructor Summary
ConstructorDescriptionReadOnlyAndReadWriteTransactionConversionTemplate
(org.springframework.transaction.PlatformTransactionManager transactionManager) -
Method Summary
Modifier and TypeMethodDescriptionexecuteInReadOnly
(Supplier<T> callback) executeInReadOnly
(Supplier<T> inReadOnlyCallback, Supplier<T> notInReadOnlyCallback) Checks if the current transaction is in readonly mode, and creates a new transaction in readonly mode if not.executeInReadWrite
(Supplier<T> callback) Checks if the current transaction is in read/write mode, and creates a new transaction in read/write mode if not.
-
Constructor Details
-
ReadOnlyAndReadWriteTransactionConversionTemplate
public ReadOnlyAndReadWriteTransactionConversionTemplate(org.springframework.transaction.PlatformTransactionManager transactionManager)
-
-
Method Details
-
executeInReadOnly
- Since:
- 9.1
-
executeInReadOnly
Checks if the current transaction is in readonly mode, and creates a new transaction in readonly mode if not.- Parameters:
inReadOnlyCallback
- To be executed if the current transaction is in readonly mode.notInReadOnlyCallback
- To be executed in a new read only transaction if the current transaction is not in readonly mode.- Returns:
- the result of the callback.
-
executeInReadWrite
Checks if the current transaction is in read/write mode, and creates a new transaction in read/write mode if not.- Parameters:
callback
- to be executed in the transaction.- Returns:
- the result of the callback.
-