- All Implemented Interfaces:
Serializable
Callbacks run after the transaction has completed, so this exception reports a failed side effect rather
than a failed transaction. isCommitted() says which completion it followed: true when the
transaction committed, false when it rolled back.
Catching this type is what lets a caller tell "the work was not persisted" apart from "the work was persisted and something after it failed". The two need opposite responses: the first is a candidate for a retry, the second usually is not, because retrying repeats work that already succeeded.
When several callbacks fail, the first failure is the cause and the remaining ones are attached to it as suppressed exceptions. A callback failure that follows a rollback caused by another exception is not thrown on its own: it is attached to that exception as suppressed, still wrapped in this type.
- Since:
- 1.13
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTransactionCallbackException(String message, Throwable cause, boolean committed) -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether the transaction committed before the failing callback ran.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
TransactionCallbackException
-
-
Method Details
-
isCommitted
public boolean isCommitted()Whether the transaction committed before the failing callback ran.- Returns:
truewhen the transaction committed,falsewhen it rolled back.
-