Interface TransactionResult
- All Known Subinterfaces:
OptimisticLockingTransactionResult<I>
- All Known Implementing Classes:
OptimisticLockingTransactionResultImpl,TransactionResultImpl
A structure holding the result of the commands executed in a transaction. Note that the result are ordered, and the
(0-based) index of the command must be used to retrieve the result of a specific command.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if the transaction was discarded (rolled back)<T> Tget(int index) Returns the response at the specified position in thisTransactionResult.booleanChecks if at least one command in the transaction ended with an error.booleanisEmpty()Returnstrueif thisTransactionResultcontains no responses.intsize()Returns the number of responses.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
discarded
boolean discarded()Checks if the transaction was discarded (rolled back)- Returns:
trueif the transaction batch was discarded.
-
hasErrors
boolean hasErrors()Checks if at least one command in the transaction ended with an error. Errors are represented asThrowables in the list of results.- Returns:
trueif at least one command in the transaction ended with an error
-
size
int size()Returns the number of responses.- Returns:
- the number of responses
-
isEmpty
boolean isEmpty()Returnstrueif thisTransactionResultcontains no responses.- Returns:
trueif thisTransactionResultcontains no responses
-
get
<T> T get(int index) Returns the response at the specified position in thisTransactionResult. It contains the result of the commands executed at the same position in the transaction. If that command ended with an error, the return value is aThrowable.- Type Parameters:
T- the expected type- Parameters:
index- index of the element to return- Returns:
- the element at the specified position in this
TransactionResult
-