Class TransactionRetryResult<T>
java.lang.Object
com.pyranid.TransactionRetryResult<T>
Result of a successful
Database.transactionWithRetry(RetryPolicy, ReturningTransactionalOperation) call.
Retry methods return this type instead of a bare Optional so callers can inspect failures that were recovered
before the transaction eventually succeeded.
If retry attempts are exhausted, Pyranid throws the final DatabaseException instead of returning this type. Prior
failed attempts are attached to the thrown exception as suppressed exceptions.
- Since:
- 4.4.0
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescription@NonNull IntegerGets the number of transaction attempts, including the successful final attempt.@NonNull List<@NonNull DatabaseException> Gets the failed attempts that were retried before the transaction eventually succeeded.getValue()Gets the value returned by the successful transaction attempt.@NonNull BooleanIndicates whether at least one failed attempt was retried before success.
-
Method Details
-
getValue
-
getFailures
Gets the failed attempts that were retried before the transaction eventually succeeded.Failures are returned in occurrence order. The returned list is immutable.
- Returns:
- failed attempts that were retried before success
-
getAttemptCount
Gets the number of transaction attempts, including the successful final attempt.- Returns:
- attempt count
-
wasRetried
Indicates whether at least one failed attempt was retried before success.- Returns:
trueif the transaction succeeded after retrying,falseotherwise
-