Class ReadOnlyAndReadWriteTransactionConversionTemplate<T>
- java.lang.Object
-
- com.atlassian.confluence.api.impl.ReadOnlyAndReadWriteTransactionConversionTemplate<T>
-
- Type Parameters:
T
-
public class ReadOnlyAndReadWriteTransactionConversionTemplate<T> extends Object
Provides methods for changing between read/write and readonly transactions.- Since:
- 5.10
-
-
Constructor Summary
Constructors Constructor Description ReadOnlyAndReadWriteTransactionConversionTemplate(org.springframework.transaction.PlatformTransactionManager transactionManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
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.T
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.
-
-
-
Method Detail
-
executeInReadOnly
public T 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.- 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.
-
-