public interface TransactionContext extends ReadTransactionContext
Transaction is available for database operations. The
behavior of the methods specified in this interface, especially in the face
errors, is implementation specific. In particular, some implementations will
run Functions multiple times (retry) when certain errors are encountered.
Therefore a Function should be prepared to be called more than once. This
consideration means that a Function should use caution when directly
modifying state in a class, especially in a way that could be observed were that
Function to not complete successfully.| Modifier and Type | Method and Description |
|---|---|
<T> T |
run(java.util.function.Function<? super Transaction,T> retryable)
Runs a function in this context that takes a transaction.
|
<T> java.util.concurrent.CompletableFuture<T> |
runAsync(java.util.function.Function<? super Transaction,? extends java.util.concurrent.CompletableFuture<T>> retryable)
Runs a function in this context that takes a transaction.
|
getExecutor, read, readAsync<T> T run(java.util.function.Function<? super Transaction,T> retryable)
T - the return type of retryableretryable - the block of logic to execute against a Transaction
in this contextretryable<T> java.util.concurrent.CompletableFuture<T> runAsync(java.util.function.Function<? super Transaction,? extends java.util.concurrent.CompletableFuture<T>> retryable)
CompletableFuture that will be set when the process is complete.T - the return type of retryableretryable - the block of logic to execute against a Transaction
in this contextCompletableFuture that will be set to the value returned by the last call
to retryable