Class TransactionOutcome<T>
java.lang.Object
com.pyranid.TransactionOutcome<T>
- Type Parameters:
T- the callback value type
The completed database outcome, attempted callback value and invocation failure of one transaction boundary.
A callback value does not establish commit, and a failure does not establish rollback: cleanup or a post-transaction hook can fail after a successful commit. Independent nested transactions and external side effects are outside this boundary's result. This result is process-local, not a durable business receipt or permission to replay an operation.
The outcome container is thread-safe. The callback value and original failure are retained by reference;
neither is copied or guaranteed immutable or thread-safe, so access to their mutable state requires its own
coordination. A final Error escapes the invocation instead of being retained in an outcome.
- Since:
- 4.9.0
-
Method Summary
Modifier and TypeMethodDescriptionGets the value returned normally by the callback, even if completion subsequently rolled back, became uncertain or failed after commit.Gets the final completion, after connection cleanup and post-transaction hooks.Gets the final invocation failure the traditional transaction API would throw, retaining its identity, wrapping and suppressed failures.Gets this boundary's database result, independently of the callback value and invocation failure.
-
Method Details
-
getCompletion
Gets the final completion, after connection cleanup and post-transaction hooks. A configured completion observer receives this same instance. Its identifiers correlate process-local boundaries, not durable operations.- Returns:
- the completion for this transaction boundary
-
getResult
Gets this boundary's database result, independently of the callback value and invocation failure. Boundaries without physical JDBC work retain their logical commit or rollback result.- Returns:
- the database result
-
getAttemptedValue
Gets the value returned normally by the callback, even if completion subsequently rolled back, became uncertain or failed after commit. A callback that throws has no attempted value. Void callbacks, an empty optional and an accidentally null optional all produce an empty value.- Returns:
- the attempted callback value, if any
-
getFailure
Gets the final invocation failure the traditional transaction API would throw, retaining its identity, wrapping and suppressed failures. A committed transaction can have a failure, while normal rollback-only completion has none. Unrecognized failures, including programming errors, should normally be rethrown.- Returns:
- the invocation failure, or empty for successful invocation completion
-